Newbie alert! :)

Guys, I am trying to update a record on the console (Heroku)
I have an object called Photo
Photos have a tittle,... how do I address an specific photo via it's
Id if I want to
update the tittle description etc?


Any help will be great.

--
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.

Search Discussions

  • Walter Lee Davis at Feb 10, 2012 at 7:56 pm

    On Feb 10, 2012, at 5:30 AM, abenego wrote:

    Newbie alert! :)

    Guys, I am trying to update a record on the console (Heroku)
    I have an object called Photo
    Photos have a tittle,... how do I address an specific photo via it's
    Id if I want to
    update the tittle description etc?
    If you know the ID, then you can do this:

    photo = Photo.find 123
    photo.title = 'A greater title than before'
    photo.save

    Walter
    Any help will be great.

    --
    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.
    --
    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.
  • Linus Pettersson at Feb 10, 2012 at 8:39 pm
    Yep, or:
    Photo.find(123).update_attribute(:title => "New great title")

    Regards

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/-0h5vJWe_s4J.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 10, '12 at 6:28p
activeFeb 10, '12 at 8:39p
posts3
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2022 Grokbase