Can someone have a quick gander at this application.rb file http://pastie.textmate.org/130228 What Im trying to do is make available to controllers lower down a @recipe so I don''t have to do this in every controller that needs it recipe = User.find(session[:user_id]).recipe.find(param[:id]) At the top of the controllers that use this I use.. before_filter :authorize before_filter :fetch_recipe Say the controller being used for this is an Ingredients controller (Recipe has many ingredients). What happens is that although I can add Ingredients it seaams that the flash[:notice] always seams to get set in the application.rb Any ideas? -- 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 -~----------~----~----~----~------~----~------~--~---
Hi Chris, I think you can just reset the flash[:notice] to null value in the beginning of the action.so that it will show the null value or just check for small condition. if flash[:notice] # display the message. end Chris Lock wrote:> Can someone have a quick gander at this application.rb file > > http://pastie.textmate.org/130228 > > What Im trying to do is make available to controllers lower down a > @recipe so I don''t have to do this in every controller that needs it > > recipe = User.find(session[:user_id]).recipe.find(param[:id]) > > At the top of the controllers that use this I use.. > > before_filter :authorize > before_filter :fetch_recipe > > Say the controller being used for this is an Ingredients controller > (Recipe has many ingredients). What happens is that although I can add > Ingredients it seaams that the flash[:notice] always seams to get set in > the application.rb > > Any ideas?-- 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 -~----------~----~----~----~------~----~------~--~---
Mohan Kumar wrote: Cheers for the reply Mohan> I think you can just reset the flash[:notice] to null value in the > beginning of the action.so that it will show the null value or just > check for small condition.Yeah thats one way around it, the thing is that the flash should not be being set at all, Ive traced this through and the code seams to happyily find the recipe so why on earth does it still perform the rescue action> if flash[:notice] > # display the message. > endI''ll check this is set in my view Thanks for chipping in :) - Chris -- 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 -~----------~----~----~----~------~----~------~--~---
>> if flash[:notice] >> # display the message. >> endHi we do use flash[:notice] in our application but how we use is Example: format.js { render :update do |page| if @record.save flash[:success] = ''Record created successfully!'' @records = Record.find(:all) page.replace_html ''admin_table_rows'', :partial=>''rows'' else page.replace_html ''new_record'', :partial => ''new'' end end flash[:success] = nil } -- 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 -~----------~----~----~----~------~----~------~--~---