Posted By

rayonrails on 02/21/11


Tagged

permalink


Versions (?)

Generate Permalink


 / Published in: Rails
 

  1. before_create :generate_permalink
  2.  
  3. def geerate_permanlink
  4. @attributes['permalink'] = name.downcase.gsub(/\s+/,'_').gsub(/[^a-zA-Z0-9_]+/,'')
  5. end

Report this snippet  

You need to login to post a comment.