Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

unnecessary loading parent resource with :shallow => true #983

Open
virvit opened this issue Jan 10, 2014 · 0 comments
Open

unnecessary loading parent resource with :shallow => true #983

virvit opened this issue Jan 10, 2014 · 0 comments

Comments

@virvit
Copy link

virvit commented Jan 10, 2014

Hello.

I've simple controller
class ChildsController < ApplicationController
load_and_authorize_resource :parent
load_and_authorize_resource :child, :through => :parent, :shallow => true

As far as I understand we don't need parent object with shallow option/route in show/update/destroy actions. But these lines will load it everytime (parent object). So when I call ChildsController#show with id = 1 it always looks for params[:parent_id] and fails to find it (so action doesn't execute further).

Is there a way to avoid looking for parent objects with shallow option without explicit declaration :except => [:show, :update, :destroy] for parent object?

Thank you for your job!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant