Skip to content
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

parent not available on new/create action #47

Closed
semarco opened this issue Mar 16, 2010 · 2 comments
Closed

parent not available on new/create action #47

semarco opened this issue Mar 16, 2010 · 2 comments

Comments

@semarco
Copy link

semarco commented Mar 16, 2010

i have some nested resources, and i check resource authorization with cancan.
in my ability.rb i need to check authorization on the parents rescource, so i set it in current_ability

this works fine, but it seams that on new or create actions the parent is set in IR.

any idea?
thanks a lot,
marco

@josevalim
Copy link
Contributor

The parents are set in all actions. Which error are you getting? What led you to think otherwise?

@semarco
Copy link
Author

semarco commented Mar 16, 2010

thanks for answering this quick.
your are right, the parent is set on all views, but its not available on all actions in the controller.
i've also just found that when i call association_chain, the parent is available corrrectly on all actions.

class BaseController < InheritedResources::Base

before_filter :trigger_parent_assignment

def trigger_parent_assignment
association_chain
end
end

thanks, anyway!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants