Ruby on Rails Tuesday, May 17, 2011

or p.update_attribute(:title, p.title.capitalize) and without p.save

or if you want to capitalize in your model (when saving), you could do that with before filter

before_save do |row|
row.title = row.title.capitalize unless row.title.blank?
end

tom

On May 17, 2011, at 22:17 , james b. wrote:

> Thanks very much i had been pondering on this for a while
>
> Final Solution:
>
> p.title = p.title.capitalize
> instead of
> p.title.capitalize!
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

--
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz
===============================================================================

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment