Ruby on rails 奇怪的闪光行为
在我的项目中,我有一个地方,闪存数据正在消失。 我的控制器(不重要的代码已被删除): 安置路线:Ruby on rails 奇怪的闪光行为,ruby-on-rails,ruby-on-rails-3.2,rails-flash,Ruby On Rails,Ruby On Rails 3.2,Rails Flash,在我的项目中,我有一个地方,闪存数据正在消失。 我的控制器(不重要的代码已被删除): 安置路线: resource :placement, :controller => 'Placement' 还有我的js: $(function(){ $('.placement-link').on('click', function(){ $("#placement_form").submit(); }); }) 因此,当我单击placement链接时,它会重定向到我的视图,但没
resource :placement, :controller => 'Placement'
还有我的js:
$(function(){
$('.placement-link').on('click', function(){
$("#placement_form").submit();
});
})
因此,当我单击placement链接时,它会重定向到我的视图,但没有flash。很奇怪。我尝试了几种闪光辅助的方法-同样的结果。这种行为只在我的项目中的这个地方发生
如果可能有用的话,我正在使用rails 3.2.8和rails 1.3.1
UPD。问题是Javascript在添加
$(function(){
$('.placement-link').on('click', function(){
$("#placement_form").submit();
});
})
一切正常
show.htm.haml view
link_to t("layout.placement.populate"), edit_placement_path(@placement), class: "btn btn-success placement-link pull-right
在中显示操作
def show
@placement = Placement.find(params[:id])
end
def edit
@placement = Placement.find(params[:id])
end
def update
@placement = Placement.find(params[:id])
respond_to do |format|
if @user.update_attributes(params[:user])
format.html { redirect_to placement_path(tyle: "entry"), notice: 'flash message' }
else
format.html { render action: "edit" }
end
end
end
我说,让闪光消失吧。它很老了,想永垂不朽。@amn,这不是关于Adobe Flash,这是Ruby on Rails框架中的Flash消息=)@Denistautaurov stackoverflow不知道你的意图,还有一个Rails Flash标签
show.htm.haml view
link_to t("layout.placement.populate"), edit_placement_path(@placement), class: "btn btn-success placement-link pull-right
def show
@placement = Placement.find(params[:id])
end
def edit
@placement = Placement.find(params[:id])
end
def update
@placement = Placement.find(params[:id])
respond_to do |format|
if @user.update_attributes(params[:user])
format.html { redirect_to placement_path(tyle: "entry"), notice: 'flash message' }
else
format.html { render action: "edit" }
end
end
end