Open KonstantinKo opened 10 years ago
What was the problem with this code?
def permitted_params
params.for(resource).refine
end
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.
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
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
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.