This is strange: I''m doing the following in script/console:>> Contract.find(:all) do |c|?> if c.use_initial_published_date>> c.initial_published_date = Date.today >> c.save! >> end >> endFor some reason it is not saving the updated the records when I do this. Does anyone see a glaring error I''m making? c.use_initial_publised_date is a boolean that is true for the last 3 records and false for the other 100. thanks -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You''re missing the "each" call.>> Contract.all.each do |c|?> if c.use_initial_published_date>> c.initial_published_date = Date.today >> c.save! >> end >> end- Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Fri, Feb 20, 2009 at 4:54 PM, Allen Walker <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > This is strange: I''m doing the following in script/console: > >>> Contract.find(:all) do |c| > ?> if c.use_initial_published_date >>> c.initial_published_date = Date.today >>> c.save! >>> end >>> end > > For some reason it is not saving the updated the records when I do this. > Does anyone see a glaring error I''m making? c.use_initial_publised_date > is a boolean that is true for the last 3 records and false for the other > 100. > > thanks > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
LOL thanks. i drank too much last night i guess. Maurício Linhares wrote:> You''re missing the "each" call. > > > On Fri, Feb 20, 2009 at 4:54 PM, Allen Walker-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---