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.

有帮助吗?

解决方案

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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top