edit input value before saving in Rails -


hi have simple input field url user:

<%= f.text_field :url, :value=>"#{@url_website}" %> 

i process input check if put http:// before it, , if not, add manually. run function on before saving? how done?

thanks!

well should put before_save in model format text, if model this

before_save :format_url  def format_url     #put important here end 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -