How to customize the new and edit pages for a model #3679
Unanswered
azad-betacraft
asked this question in
Q&A
Replies: 1 comment
-
Hi there. You can register your custom controller/action in rails admin. In # Register new action
module RailsAdmin
module Config
module Actions
class MyAction < RailsAdmin::Config::Actions::Base
RailsAdmin::Config::Actions.register(self)
register_instance_option(:member) { true }
register_instance_option(:visible?) { true }
register_instance_option :controller do
# describe response here. You can use standard Rails methods like render or redirect
proc { render json: '123' }
end
register_instance_option(:link_icon) { 'fas fa-pencil-alt' }
register_instance_option(:pjax?) { false }
end
end
end
end
RailsAdmin.config do |config|
...
config.actions do
dashboard
index
new
show
edit
delete
show_in_app
my_action # add the action
end
... Then you will see this new action for your models. Hope this will help. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want a customize new and edit page for a model and also want to change the controller action to handle those forms so how should I do that?
Beta Was this translation helpful? Give feedback.
All reactions