I am having an issue where I cannot get the notice to show up on a custom action in redirect_to in the routes I have this defined: match ''launches/calendar'' => ''launches#calendar'' in the launches controller I have these entries: def calendar @launches = Launch.all @date = params[:month] ? Date.parse(params[:month]) : Date.today end def update @launch = Launch.find(params[:id]) if @launch.update_attributes(params[:launch]) redirect_to :action =>''calendar'', :notice => "Successfully updated launch." else render :action => ''edit'' end end in the calander view file I have the following: <p id="notice"><%= notice %></p> but nothing ever shows up. I am sure I am making a silly mistake here. Just can''t find it. Thanks, Dal -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
did some more research and playing and got it to work by changing: redirect_to :action =>''calendar'', :notice => "Successfully updated launch." to: flash[:notice] = "Successfully updated launch." redirect_to :action => :calendar now it seems to work... On May 4, 11:38 am, dalupus <dalu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am having an issue where I cannot get the notice to show up on a > custom action in redirect_to > > in the routes I have this defined: > > match ''launches/calendar'' => ''launches#calendar'' > > in the launches controller I have these entries: > def calendar > @launches = Launch.all > @date = params[:month] ? Date.parse(params[:month]) : Date.today > end > > def update > @launch = Launch.find(params[:id]) > if @launch.update_attributes(params[:launch]) > redirect_to :action =>''calendar'', :notice => "Successfully > updated launch." > else > render :action => ''edit'' > end > end > > in the calander view file I have the following: > > <p id="notice"><%= notice %></p> > > but nothing ever shows up. > > I am sure I am making a silly mistake here. Just can''t find it. > > Thanks, > Dal-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
On May 4, 4:38 pm, dalupus <dalu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am having an issue where I cannot get the notice to show up on a > custom action in redirect_to > > in the routes I have this defined: > > match ''launches/calendar'' => ''launches#calendar'' > > in the launches controller I have these entries: > def calendar > @launches = Launch.all > @date = params[:month] ? Date.parse(params[:month]) : Date.today > end > > def update > @launch = Launch.find(params[:id]) > if @launch.update_attributes(params[:launch]) > redirect_to :action =>''calendar'', :notice => "Successfully > updated launch."when you do this it things that notice is part of the routing options. redirect_to({:action => ''calendar''}, :notice => ''...'') should work, as should redirect_to something_path, :notice => ''....'' Fred -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.