我正在尝试使用此处创建链接:
<%= link_to "Edit Pics", edit_property_gallery_path(property, gallery) %>
我的路线是这样的:
edit_property_gallery GET /properties/:property_id/galleries/:id/edit(.:format) galleries#edit
但我得到了这个
[]
我正在设置我的空间仪表板控制器,带有像这样的set_gallery方法
def set_gallery
@gallery = Gallery.find(params[:id])
end
你能帮我看看我是怎么得到这个错误的。感谢。
以下是相关路线信息:
resources :properties do
collection do
get 'search'
end
resources :galleries
end
resources :spaces do
collection do
get 'search'
end
resources :galleries do
resources :pictures
end
这是我的佣金路线输出:
Zacharys-MBP:swing zak$ rake routes
Prefix Verb URI Pattern Controller#Action
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) registrations#cancel
user_registration POST /users(.:format) registrations#create
new_user_registration GET /users/sign_up(.:format) registrations#new
edit_user_registration GET /users/edit(.:format) registrations#edit
PATCH /users(.:format) registrations#update
PUT /users(.:format) registrations#update
DELETE /users(.:format) registrations#destroy
admin_root GET /admin(.:format) admin/dashboard#index
admin_dashboard GET /admin/dashboard(.:format) admin/dashboard#index
batch_action_admin_properties POST /admin/properties/batch_action(.:format) admin/properties#batch_action
admin_properties GET /admin/properties(.:format) admin/properties#index
POST /admin/properties(.:format) admin/properties#create
new_admin_property GET /admin/properties/new(.:format) admin/properties#new
edit_admin_property GET /admin/properties/:id/edit(.:format) admin/properties#edit
admin_property GET /admin/properties/:id(.:format) admin/properties#show
PATCH /admin/properties/:id(.:format) admin/properties#update
PUT /admin/properties/:id(.:format) admin/properties#update
DELETE /admin/properties/:id(.:format) admin/properties#destroy
batch_action_admin_spaces POST /admin/spaces/batch_action(.:format) admin/spaces#batch_action
admin_spaces GET /admin/spaces(.:format) admin/spaces#index
POST /admin/spaces(.:format) admin/spaces#create
new_admin_space GET /admin/spaces/new(.:format) admin/spaces#new
edit_admin_space GET /admin/spaces/:id/edit(.:format) admin/spaces#edit
admin_space GET /admin/spaces/:id(.:format) admin/spaces#show
PATCH /admin/spaces/:id(.:format) admin/spaces#update
PUT /admin/spaces/:id(.:format) admin/spaces#update
DELETE /admin/spaces/:id(.:format) admin/spaces#destroy
batch_action_admin_users POST /admin/users/batch_action(.:format) admin/users#batch_action
admin_users GET /admin/users(.:format) admin/users#index
POST /admin/users(.:format) admin/users#create
new_admin_user GET /admin/users/new(.:format) admin/users#new
edit_admin_user GET /admin/users/:id/edit(.:format) admin/users#edit
admin_user GET /admin/users/:id(.:format) admin/users#show
PATCH /admin/users/:id(.:format) admin/users#update
PUT /admin/users/:id(.:format) admin/users#update
DELETE /admin/users/:id(.:format) admin/users#destroy
admin_comments GET /admin/comments(.:format) admin/comments#index
POST /admin/comments(.:format) admin/comments#create
admin_comment GET /admin/comments/:id(.:format) admin/comments#show
DELETE /admin/comments/:id(.:format) admin/comments#destroy
pictures GET /pictures(.:format) pictures#index
POST /pictures(.:format) pictures#create
new_picture GET /pictures/new(.:format) pictures#new
edit_picture GET /pictures/:id/edit(.:format) pictures#edit
picture GET /pictures/:id(.:format) pictures#show
PATCH /pictures/:id(.:format) pictures#update
PUT /pictures/:id(.:format) pictures#update
DELETE /pictures/:id(.:format) pictures#destroy
search_properties GET /properties/search(.:format) properties#search
property_galleries GET /properties/:property_id/galleries(.:format) galleries#index
POST /properties/:property_id/galleries(.:format) galleries#create
new_property_gallery GET /properties/:property_id/galleries/new(.:format) galleries#new
edit_property_gallery GET /properties/:property_id/galleries/:id/edit(.:format) galleries#edit
property_gallery GET /properties/:property_id/galleries/:id(.:format) galleries#show
PATCH /properties/:property_id/galleries/:id(.:format) galleries#update
PUT /properties/:property_id/galleries/:id(.:format) galleries#update
DELETE /properties/:property_id/galleries/:id(.:format) galleries#destroy
properties GET /properties(.:format) properties#index
POST /properties(.:format) properties#create
new_property GET /properties/new(.:format) properties#new
edit_property GET /properties/:id/edit(.:format) properties#edit
property GET /properties/:id(.:format) properties#show
PATCH /properties/:id(.:format) properties#update
PUT /properties/:id(.:format) properties#update
DELETE /properties/:id(.:format) properties#destroy
search_spaces GET /spaces/search(.:format) spaces#search
space_gallery_pictures GET /spaces/:space_id/galleries/:gallery_id/pictures(.:format) pictures#index
POST /spaces/:space_id/galleries/:gallery_id/pictures(.:format) pictures#create
new_space_gallery_picture GET /spaces/:space_id/galleries/:gallery_id/pictures/new(.:format) pictures#new
edit_space_gallery_picture GET /spaces/:space_id/galleries/:gallery_id/pictures/:id/edit(.:format) pictures#edit
space_gallery_picture GET /spaces/:space_id/galleries/:gallery_id/pictures/:id(.:format) pictures#show
PATCH /spaces/:space_id/galleries/:gallery_id/pictures/:id(.:format) pictures#update
PUT /spaces/:space_id/galleries/:gallery_id/pictures/:id(.:format) pictures#update
DELETE /spaces/:space_id/galleries/:gallery_id/pictures/:id(.:format) pictures#destroy
space_galleries GET /spaces/:space_id/galleries(.:format) galleries#index
POST /spaces/:space_id/galleries(.:format) galleries#create
new_space_gallery GET /spaces/:space_id/galleries/new(.:format) galleries#new
edit_space_gallery GET /spaces/:space_id/galleries/:id/edit(.:format) galleries#edit
space_gallery GET /spaces/:space_id/galleries/:id(.:format) galleries#show
PATCH /spaces/:space_id/galleries/:id(.:format) galleries#update
PUT /spaces/:space_id/galleries/:id(.:format) galleries#update
DELETE /spaces/:space_id/galleries/:id(.:format) galleries#destroy
evaluate_space_contract GET /spaces/:space_id/contracts/:id/evaluate(.:format) contracts#evaluate
tenant_evaluate_space_contract GET /spaces/:space_id/contracts/:id/tenant_evaluate(.:format) contracts#tenant_evaluate
space_contracts GET /spaces/:space_id/contracts(.:format) contracts#index
POST /spaces/:space_id/contracts(.:format) contracts#create
new_space_contract GET /spaces/:space_id/contracts/new(.:format) contracts#new
edit_space_contract GET /spaces/:space_id/contracts/:id/edit(.:format) contracts#edit
space_contract GET /spaces/:space_id/contracts/:id(.:format) contracts#show
PATCH /spaces/:space_id/contracts/:id(.:format) contracts#update
PUT /spaces/:space_id/contracts/:id(.:format) contracts#update
DELETE /spaces/:space_id/contracts/:id(.:format) contracts#destroy
space_reviews GET /spaces/:space_id/reviews(.:format) reviews#index
POST /spaces/:space_id/reviews(.:format) reviews#create
new_space_review GET /spaces/:space_id/reviews/new(.:format) reviews#new
edit_space_review GET /spaces/:space_id/reviews/:id/edit(.:format) reviews#edit
space_review GET /spaces/:space_id/reviews/:id(.:format) reviews#show
PATCH /spaces/:space_id/reviews/:id(.:format) reviews#update
PUT /spaces/:space_id/reviews/:id(.:format) reviews#update
DELETE /spaces/:space_id/reviews/:id(.:format) reviews#destroy
spaces GET /spaces(.:format) spaces#index
POST /spaces(.:format) spaces#create
new_space GET /spaces/new(.:format) spaces#new
edit_space GET /spaces/:id/edit(.:format) spaces#edit
space GET /spaces/:id(.:format) spaces#show
PATCH /spaces/:id(.:format) spaces#update
PUT /spaces/:id(.:format) spaces#update
DELETE /spaces/:id(.:format) spaces#destroy
root GET / spaces#index
payment GET /payment(.:format) contracts#payment
dashboard GET /dashboard(.:format) spaces#dashboard
about_us GET /about_us(.:format) marketing_pages#about_us
team GET /team(.:format) marketing_pages#team
how_it_works GET /how_it_works(.:format) marketing_pages#how_it_works
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
messages GET /messages(.:format) redirect(301, /conversations)
message POST /messages/:id(.:format) messages#new
GET /messages(.:format) messages#index
POST /messages(.:format) messages#create
new_message GET /messages/new(.:format) messages#new
edit_message GET /messages/:id/edit(.:format) messages#edit
GET /messages/:id(.:format) messages#show
PATCH /messages/:id(.:format) messages#update
PUT /messages/:id(.:format) messages#update
DELETE /messages/:id(.:format) messages#destroy
reply_conversation POST /conversations/:id/reply(.:format) conversations#reply
trash_conversation POST /conversations/:id/trash(.:format) conversations#trash
untrash_conversation POST /conversations/:id/untrash(.:format) conversations#untrash
trashbin_conversations GET /conversations/trashbin(.:format) conversations#trashbin
empty_trash_conversations POST /conversations/empty_trash(.:format) conversations#empty_trash
conversations GET /conversations(.:format) conversations#index
POST /conversations(.:format) conversations#create
new_conversation GET /conversations/new(.:format) conversations#new
edit_conversation GET /conversations/:id/edit(.:format) conversations#edit
conversation GET /conversations/:id(.:format) conversations#show
PATCH /conversations/:id(.:format) conversations#update
PUT /conversations/:id(.:format) conversations#update
DELETE /conversations/:id(.:format) conversations#destroy
答案 0 :(得分:0)
您似乎应该按以下方式调用您的网址助手:
edit_property_gallery_path(gallery, property_id: property.id)
您的gallery
和property
参数已被切换,我认为您不能使用property
作为第二个参数,哈希肯定会有效。