Nidhin S G
Nidhin S G

Reputation: 1695

Active Admin Model Updation

Im using active admin gem.

My doubt is can i create a new column in another table, while updating a table using active admin gem.

If possible show me some tutorials..

Like im in user.rb model.. and im editing it via active admin.. I have entered a name and while saving i want this name to get saved in another model too.at the same time.

Upvotes: 0

Views: 127

Answers (1)

Jenorish
Jenorish

Reputation: 1714

Please try like this:

controller do
 def create
   create! # this will do default operations
   # Do your stuff here
 end
end

In active admin internally they are using inherited resources.

or try like

ActiveAdmin.register User do
  after_create do |user|
  product.creator = user.name
 end
end

Upvotes: 2

Related Questions