Reputation: 2584
i'm using rails_admin gem, is possible to override an action of a specific controller like this:
I'm using the InheritedResources gem by josevalim https://github.com/josevalim/inherited_resources
this is the controller for the "normal" user.
class EventsController < InheritedResources::Base
load_and_authorize_resource
def create
staff=Staff.find(params[:event][:author_id])
staff.create_user(name: staff.name,email:staff.email) unless staff.user
create!
end
end
I want to override the create action of the rails_admin controller for the Event model, as I have just override a "normal" controller. Is possible?
Upvotes: 4
Views: 1796
Reputation: 584
You might want to create a custom action and use it instead of create
action.
This answer is helpful too.
Quote from it:
Upvotes: 1