Hello!
I'm wondering how exactly authorized_for_create? and authorized_for_new?
work and which one I need to use. Does _new show/hide the "Create
New"-link and _create simply (dis)allows creating a new instance and
saving it into the db?
Suppose there's an awesome_nested_set 'markers', and I'd like to allow
only creation of root nodes and nodes directly below those (level 0 and 1).
When I create a marker as a submarker of a root-marker, the request
looks like this:
Processing MarkersController#create (for x at y) [POST]
Parameters: {"eid"=>"3f1ea33b0ab5b9c5bfe3ce2dc256ee35",
"parent_column"=>"children", "commit"=>"Create", "nested"=>"true",
"action"=>"create",
"authenticity_token"=>"n854NxNJno4qC/gIzc1f9aHdeSSCjRMPGyyqCN8g2n8=",
"parent_model"=>"Marker", "controller"=>"markers",
"record"=>{"name"=>"asdasd"}}
Given the parent-marker doesn't show up in this request, how could I
check for the level of the about-to-be-created node in the ANS-tree?
It also seems that authorized_for_create? is executed twice in response
to a MarkersController#new request. Why is that?
And lastly, whats the difference between a create_authorized? in the
controller and a authorized_for_create? in the model? Does one need both
because they're called in different times/contexts and have access to
different data to make the decision?
thanks,
ben
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en.