I recently just updated to rails 2.0.1, and since all my .save methods
dont seem to work, as if they are just skipped.
no errors are outputed, and no update sql statements are showing up in
log file.
sample code im using...
def mark_answer
if(params[:id])
question = @current_user.questions.find(params[:id])
if(question)
question.question_answer_id = params[:answer_id]
question.save
notification = UserNotification.new(:user_id =>
question.question_answer.user.id)
notification.body = @current_user.login + " has marked your
answer as the solution "
notification.save
end
redirect_to :action => ''show'', :id => params[:id]
else
redirect_to "/404.html"
end
end
A new notification gets updated to DB, but nothing question isnt
updated.
Any ideas?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
On 10 Dec 2007, at 07:48, Chubbs wrote:> > I recently just updated to rails 2.0.1, and since all my .save methods > dont seem to work, as if they are just skipped. >Try changing the save to save!. It should throw an exception about why it can''t save Fred> no errors are outputed, and no update sql statements are showing up in > log file. > > sample code im using... > > def mark_answer > if(params[:id]) > question = @current_user.questions.find(params[:id]) > > if(question) > question.question_answer_id = params[:answer_id] > question.save > > notification = UserNotification.new(:user_id => > question.question_answer.user.id) > notification.body = @current_user.login + " has marked your > answer as the solution " > notification.save > > end > > redirect_to :action => ''show'', :id => params[:id] > else > redirect_to "/404.html" > end > end > > > > A new notification gets updated to DB, but nothing question isnt > updated. > > Any ideas? > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
thanks for that, didnt know what save! did till now. showed a problem with my validation. cheers On Dec 10, 8:35 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 10 Dec 2007, at 07:48, Chubbs wrote: > > > > > I recently just updated to rails 2.0.1, and since all my .save methods > > dont seem to work, as if they are just skipped. > > Try changing the save to save!. It should throw an exception about why > it can''t save > Fred > > > no errors are outputed, and no update sql statements are showing up in > > log file. > > > sample code im using... > > > def mark_answer > > if(params[:id]) > > question = @current_user.questions.find(params[:id]) > > > if(question) > > question.question_answer_id = params[:answer_id] > > question.save > > > notification = UserNotification.new(:user_id => > > question.question_answer.user.id) > > notification.body = @current_user.login + " has marked your > > answer as the solution " > > notification.save > > > end > > > redirect_to :action => ''show'', :id => params[:id] > > else > > redirect_to "/404.html" > > end > > end > > > A new notification gets updated to DB, but nothing question isnt > > updated. > > > Any ideas?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---