In Active Admin Gem,how to modify the view of reso

2019-07-31 10:54发布

问题:

I have implemented ActiveAdmin in my Rails project. I have a resource called "Customer". In the navigation bar, there is an option called "New Customer" to create a customer. How can I change the view of this new customer? When I click "New Customer" button, it has to accept email from me, and it should send an invitation to that email-id.

回答1:

All you need to do is follow this

https://gist.github.com/mikeatlas/5628317

it has enough information to setup devise_invitable with active_admin

hope this will solve your problem, which u are facing in your second question

In ActiveAdmin Gem, how to add invitation count to Admin model?



回答2:

Actually we can do it by, integrating ActiveAdmin and DeviseInvitable Gems. The following link illustrates that.

Here's a link!, In which they have explained neatly.



回答3:

If your Customer model has a email field, then you can just allow only the email to be shown in the form, and override the 'create' method. Something like this:

form do |f|
  f.input :email

  f.actions
end

def create
  #send the email here 
end