class Agency < ActiveRecord::Base
has_many :events
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
attr_accessible :name, :email, :phone, :address, :city, :state, :zip,
:notes, :is_admin, :password, :password_confirmation, :remember_me
end
class Event < ActiveRecord::Base
belongs_to :agency
has_many :consumers
end
class Consumer < ActiveRecord::Base
belongs_to :event
end
在consumers_controller我想包括来自机构一些领域Active_scaffold添加到列表关联表列
active_scaffold :consumer do |conf|
list.columns = [
:agency, :event
]
end
有这样的协会机构 - >事件 - >消费。机构和消费者之间只有通过事件才有关联。
但它会导致错误。
如何包含列出任何字段表单代理表?
如何在event.agency.name上实现搜索? – aashish
@aashish,你是什么意思?如何在event.agency.name上添加active_scaffold搜索字段?或者只是建立ActiveRecord查询? –
如果你的意思是第一个,那么通过API列的可能决定是 'class ConsumersController