he el código siguiente en mi controlador de: no note en visualización después de redirigir en Rails 3
def create
@tv_show = TvShow.new(params[:tv_show])
respond_to do |format|
if @tv_show.save
format.html { redirect_to(tv_shows_path, :notice => 'Tv show was successfully created.') }
format.xml { render :xml => @tv_show, :status => :created, :location => @tv_show }
else
format.html { render :action => "new" }
format.xml { render :xml => @tv_show.errors, :status => :unprocessable_entity }
end
end
end
y la siguiente en mis tv_shows/index.html.erb
<div id="notice"><%= notice %></div>
pero cuando Creo una nueva entrada, el mensaje de notificación no aparece después de redirigir a tv_shows_path. ¿Alguien tiene una idea de por qué?
Me pregunto si podría ser específico. Estoy teniendo exactamente el mismo problema, y esta respuesta no ayuda. Mi controlador tiene 'before_filter: authenticate_user!'. ¿Es eso incorrecto? –
Lo siento, pero ya no sé cuál era el problema hace un año. Por el momento, uso has_secure_password desde Rails 3.1 y esto funciona realmente genial para mí. http://railscasts.com/episodes/270-authentication-in-rails-3-1 – maveonair