-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested collection links should honour routes #883
Nested collection links should honour routes #883
Conversation
spec/features/orders_show_spec.rb
Outdated
|
||
visit admin_order_path(payment.order) | ||
|
||
within('table') do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
spec/features/orders_show_spec.rb
Outdated
|
||
visit admin_order_path(payment.order) | ||
|
||
within('table') do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Prior to this commit if any routes where omitted for a resource like: ``` resources :users resources :orders, except: [:edit, :update] ``` Navigating directly to a orders show page would correctly omit the edit link but if another associated dashboard utilised a field that rendered using the partial _collection.html.erb like: ``` class UserDashboard < Administrate::BaseDashboard ATTRIBUTE_TYPES = { orders: Field::HasMany, } SHOW_PAGE_ATTRIBUTES = ATTRIBUTE_TYPES.keys end ``` when navigating to the users show page an error 500 would be thrown because the rendering of orders would incorrectly try to link to the non existent edit route Fixes #790
@karlentwistle very approved! Thank you ❤️ This makes having read-only routes more reliable. |
Thanks! Merging. |
Prior to this commit if any routes where omitted for a resource like: ``` resources :users resources :orders, except: [:edit, :update] ``` Navigating directly to a orders show page would correctly omit the edit link but if another associated dashboard utilised a field that rendered using the partial _collection.html.erb like: ``` class UserDashboard < Administrate::BaseDashboard ATTRIBUTE_TYPES = { orders: Field::HasMany, } SHOW_PAGE_ATTRIBUTES = ATTRIBUTE_TYPES.keys end ``` when navigating to the users show page an error 500 would be thrown because the rendering of orders would incorrectly try to link to the non existent edit route Fixes thoughtbot#790
Prior to this commit if any routes where omitted for a resource like:
Navigating directly to a orders show page would correctly omit the edit link but if another associated dashboard utilised a field that rendered using the partial
_collection.html.erb
like:when navigating to the users show page an error 500 would be thrown because the rendering of orders would incorrectly try to link to the non existent edit route
Fixes #790