1
在我的Rails应用程序我使用主动管理新动作,现在我有这样的模式(仅部分)Rails的activeadmin与相关模型
class Distributor < ActiveRecord::Base
attr_accessible :co****ime
has_many :price_lists
has_many :other_products_cross_lists
end
class OtherProductsCrossList < ActiveRecord::Base
attr_accessible :cross***pe_id
belongs_to :product_type
belongs_to :distributor
belongs_to :accumulator
belongs_to :oil
end
class Accumulator < ActiveRecord::Base
attr_accessible :capa***age
has_many :other_products_cross_lists
end
为了安全起见,我* ATTR ...
所以,如果我创建一个新的累加器,我也需要这样,那与累加器字段的我看到OtherProductsCrossList字段,并创建累加器,交叉它,我也需要做这样的按钮:更多,所以如果我需要创建多个为这个累加器交叉它会做到这一点。还要注意,id和refferertable_id必须相同......如何做到这一点?用另一种形式创建动作?
在这种情况下,我必须写很多动作和控制器...... – brabertaser19
是的,确切地说。 :) –
但也是一个很好的做法,编写自己的新的创建等方法和自己的路线? – brabertaser19