Wednesday, May 4, 2011

[Rails] redirect to and notice

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@googlegroups.com.
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate