class Pma < ActiveRecord::Base
attr_accessible :name, :status
belongs_to :division
belongs_to :dealer
has_many :pma_maps
has_many :pma_locations, :through => :pma_maps
def to_label
name
end
end
class PmaMap < ActiveRecord::Base
attr_accessible :pma_location_id, :pma_id
belongs_to :pma_location
belongs_to :pma
def to_label
"location: #{pma_location_id}, Pma:#{pma_id}"
end
end
class PmaLocation < ActiveRecord::Base
attr_accessible :post_code, :suburb
has_many :pma_maps
has_one :pma, :through => :pma_maps
def to_label
"#{suburb} #{post_code}"
end
end
On Thu, Aug 30, 2012 at 7:52 AM, Sergio Cambra <[email protected]> wrote:
> I have tested and it works, in master branch. Can you post your models (pma,
> pma_map and pma_location)?
>
> El martes, 28 de agosto de 2012 04:55:24 UTC+2, Tim Uckun escribió:
>>
>> Hey Guys.
>>
>> I have this setup.
>>
>> Pma
>> has_many :pma_maps
>> has_many :pma_locations, :through => :pma_maps
>>
>> If I put pma_locations in the column list it shows the locations but
>> if I click on the list I get this error NoMethodError (undefined
>> method `klass' for nil:NilClass):
>>
>> I tried with a nested link like this
>>
>> conf.nested.add_link(:pma_locations, :label => "Locations", :page =>
>> false)
>>
>> and I get the same error.
>>
>> If I manually fetch the locations Pma.first.pma_locations I get a list
>> no problem.
>>
>> nested link seems to be working just fine for has many but it's having
>> problems with through.
>
> --
> You received this message because you are subscribed to the Google Groups
> "ActiveScaffold : Ruby on Rails plugin" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/activescaffold/-/IOmMEHjsTgUJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/activescaffold?hl=en.
--
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].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en.