Rob Nichols wrote:
> class Vehicle < ActiveRecord::Base
>   before_save update_bit_ly_url
> 
>   def update_bit_ly_url
>     bit_ly_url = CreateURL.bit_ly_for_vehicle(self.id)
>   end
> end

Actually - just spotted that you'd have to use after_save or information 
other than the id to generate the url, as on create, the id doesn't 
exist until the object is saved. Also CreateUrl is probably a better 
ruby class name.
-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to