我在feed_controller中有下一个创建操作:
def create
@feed = Feed.new(check_params)
@new_feed = Feed.new(check_params)
@feed.member_id = current_user.member.id
if params[:commit] == "Upload Video"
if @feed.save
now_is = User.select("uploadLimit").where("email" => session[:email]).last.uploadLimit
User.update(session[:id], :uploadLimit => now_is.to_i - 1)
redirect_to "/#{params[:locale]}/feed"
flash[:notice] = "Congratulations! Your media file has been added!"
else
redirect_to "/#{params[:locale]}/feed"
flash[:notice] = "Oops! Something went wrong!"
end
end
end
我的routes.rb是:
post '/:locale/feed/create', to: "feed#create"
get '/:locale/feed/new', to: "feed#new", as: 'feed_new'
所以,我的问题是,为什么它重定向到/ create但不重定向到redirect_to "/#{params[:locale]}/feed
页面?它昨天有效,但今天我现在检查它已经停止工作了。谁知道,问题是什么?