Hello.
Scenario
--
I have these models:
Company
has_many :company_resources, :dependent => :destroy
has_many :resources, :through => :company_resources, :uniq => true
children :company_resources
cattr_reader :per_page
@@per_page = 20
CompanyResource
belongs_to :company
belongs_to :resource
cattr_reader :per_page
@@per_page = 20
Resource
has_many :company_resources, :dependent => :destroy
has_many :companies, :through => :company_resources, :uniq => true
cattr_reader :per_page
@@per_page = 20
I need to have the company_resources to be a nested_route for company.
So, for example, I need to display the company_resources of the
company: URL => companies/company_id/company_resources
For this, I have placed a children reference in the Company model and
in the CompanyResources controller I have:
auto_actions_for :company, [:index, :new, :create]
Problems:
--
1) When I try to load the above route (companies/company_id/
company_resources) there's an error:
-
Hobo::I18nError in Company_resources#index_for_company
wrong model name: "[#<company_resource id: 333, description:
"asdlkjalskdjaslkjd", created_at: "2011_01_13 16:54:29", updated_at:
"2011_01_13 16:54:29", resource_id: 1, company_id: 7>,
#<company_resource id: 334, description: "asdlkjals", created_at:
"2011_01_13 16:54:33", updated_at: "2011_01_13 16:54:33", resource_id:
1, company_id: 7>].collection.empty_message"). You might want to use
the translate/t tag/method instead.
-
So there's an error relating to the collection empty-message key. The
key passed in HOBO definitions for children is wrong?
So, I fix this by override the empty-message tag definition in the
collection:
<collection:>
<empty-message:>
<ht key="company_resource.collection.empty_message" />
</empty-message:>
</collection:>
2) The pagination just don't work.
I have the will_paginate gem in the Gemfile and the proper settings in
the models.
I'm using the latest hobo version.
Thanks!
Cheers.
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" 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/hobousers?hl=en.