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

Feature request: different roots for different actions #8

Open
KonstantinKo opened this issue May 12, 2014 · 4 comments
Open

Feature request: different roots for different actions #8

KonstantinKo opened this issue May 12, 2014 · 4 comments

Comments

@KonstantinKo
Copy link

To get arcane to cooperate with the InheritedResources gem, I had to do a little metaprogramming trickery that allows an overwrite of the self.root method for each action because I didn't find a way to get the current action inside of the #root function. I think adding a reference point like that would make a good addition to the gem in general.

@caulfield
Copy link
Contributor

What was the problem with this code?

def permitted_params
  params.for(resource).refine
end

@KonstantinKo
Copy link
Author

IR permits params for the resources and build_resources of every action. In a #new action, for example, the build fails because the required root is not available unless I set it to false. If I do however the require is not present in the #create action.

@caulfield
Copy link
Contributor

https://github.com/cloudsdaleapp/arcane/blob/master/lib/arcane/parameters.rb#L60

You can define .root or #root method in your refinery. self.action should be accessible from #root.

UPD. Sorry, This request is actual

@zeevallin
Copy link
Owner

I'm very sorry for the immense wait, not very nice of me to leave you hanging like this. What if you could specify a method in the chain to select the root key?

params.at(:published_article).refine

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

No branches or pull requests

3 participants