Can anyone help with this (I'm a novice).  I am trying to update several
attributes in the History table from inside another controller (Drill
controller)

if !(History.where("user_id = ? AND question_id = ?", current_user.id,
play_list[0][0])).empty?
     row_to_update = History.where("user_id = ? AND question_id = ?",
current_user.id, play_list[0][0])
     row_to_update.update_attributes(:date_time => Time.now, :correct =>
params[:answeredCorr)
else
      ...

I get the error:
NoMethodError: undefined method `update_attributes' for
#<ActiveRecord::Relation::ActiveRecord_Relation_History:0x00000109d80f40>
from
/Users/dcastellano1/.rvm/gems/ruby-2.1.0/gems/activerecord-4.0.3/lib/active_record/relation/delegation.rb:121:in
`method_missing'

Thank,
Dave Castellano

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/0a1f196c909971d59cff2833a44a259e%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to