Hi All,
I have similar to below condition but one more level of association.
class baz < ActiveRecord::Base
belongs_to :bag
end
In bag table only on field is there. "brand", :string
I want to search "brand" field of bag in foo controller.
class Foo < ActiveRecord::Base
has_many :bar
has_many :baz, :through => :bar
# added this line
has_many :bag, :through => :baz
end
class FooController < ApplicationController
active_scaffold :foo do |config|
config.list.columns.add :bag
config.search.columns = :bag
config.columns[:bag].search_sql = 'bags.brand'
end
end
BUT ITS NOT SEARCHING OR NOT GIVING ANY ERROR.
ANYONE have any idea how to solve this multilevel association search
problem ?????????
THanks In AdVanCe
Zeal
On Apr 7 2007, 3:36 am, "Sai Emrys" <[email protected]> wrote:
> class Foo < ActiveRecord::Base
> has_many:bar
> has_many:baz, :through => :bar
> end
>
> class FooController < ApplicationController
> active_scaffold :foo do |config|
> config.list.columns.add :baz
> config.search.columns = :baz
> config.columns[:baz].search_sql = 'baz.name'
> end
> end
>
> Searchfor 'stuff'
>
> Successfully find record where record.baz = stuff, more stuff, yet
> more stuff
>
> Its baz column however displays only "stuff" rather than the
> pre-searchdisplay of "stuff, more stuff, yet more stuff". Clicking
> 'stuff' gets the nested scaffold display, which shows a table of all
> three. Closing that nested scaffold resets the baz column for that
> item, so it is again showing "stuff, more stuff, yet more stuff" (i.e.
> what it should be).
>
> Submitted as issue #205,
>
> - Sai
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=.