Closed JohnGoodman closed 12 years ago
I'm having the same issue. It would be nice to have an easy, less verbose way to specify custom actions on models. One use case where this would be appropriate is "reset password" on a user.
+1
Proposed API:
actions do
update_password do
only User, Admin
# except Stuff, Stuff2
end
...
end
That should do it.
Meanwhile you guys can also use Cancan
can :update_password, [User, Admin]
Nice, the proposed API looks good. Thanks.
Thank for your help.
I can propose to switch on not in config.actions, but
config.model User do
actions do
update_password
end
end
undefined method `only' for #RailsAdmin::Config::Actions::MarkAsManager:0xc209728 when using the above API
actions do
mark_as_manager do
only User, Admin
# except Stuff, Stuff2
end
...
end
@meetme2meat it was just a proposal
Thanks bbenezech!
Hey All,
I wrote a custom action for my rails_admin app. I only want this action to show on in the list view of a specific model. I was finally able to achieve this by adding the action name to the default action list like so:
In my rails_admin_duplicate_program.rb file, I set the visibility like this:
Gists of these files are here: https://gist.github.com/1894506 https://gist.github.com/1894513
My question is, is there a better way to only show a custom action for a specified model?
Thanks.