所以我想有一个链接查找的方法在我的控制器,然后重定向到一个自定义页面的路径/试验/ my_plays轨道3路由重定向错误:ID =>“routename”
我米收到错误: 在 “无法使用id = my_plays找到径”, “:48:应用程序/控制器/ trails_controller.rb在`节目”“
路线:
match '/trails/my_plays', :to => "trails#my_plays", :as => :my_plays
链接:
<%= link_to "Your Trails", trails_my_plays_path %>
控制器:
def show
@trail = Trail.find(params[:id]) #48
@member = Member.find(current_user.member_id)
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @trail }
end
end
def my_plays
@trails = Trail.all # once status is working, need to change to where(:publish => true)
@follower = Play.where(:member_id => current_user.member_id)
@member = Member.find(current_user.member_id)
@followed = [] #all trails followed by current user
@follows = [] #the play record for that trail
@trails.each do |trail|
if @follower.count > 0
@follower.each do |followr|
if (followr.trail_id == trail.id)
@followed << trail
@follows << followr
end
end
end
end
respond_to do |format|
format.html { redirect_to "trails/my_plays" }
end
end
那么行数48是什么? – melekes
回应@antonk您需要发布演出活动的代码。错误似乎来自重定向到“trails/my_plays”:'format.html {redirect_to“trails/my_plays”} –