Hi Tom,
Per the discussion on irc regarding the Rails 4 branch, note that there is a separate join table 'locations_organizations' to handle:
class Location < Taxonomy
has_and_belongs_to_many :organizations
class Organization < Taxonomy
has_and_belongs_to_many :locations
The problem you were problem facing is that Rails 4 changes the naming convention of the join table.
class Location < Taxonomy
has_and_belongs_to_many :organizations, join_table: : locations_organizations
class Organization < Taxonomy
has_and_belongs_to_many :locations, join_table: : locations_organizations
Otherwise it will look for a table ' location_organizations ' (NO 's') and fail.
I would not include the relationship between Location / Organization in taxable_taxonomies.
Joseph
yup. it actually looked for taxonomies_taxonomies, which makes even less
sense…
Thanks, Joseph!
···
On Thursday, December 18, 2014 9:15:25 AM UTC+2, Joseph Magen wrote:
>
> Hi Tom,
>
> Per the discussion on irc regarding the Rails 4 branch, note that there is
> a separate join table 'locations_organizations' to handle:
>
> class Location < Taxonomy
>
> has_and_belongs_to_many :organizations
>
>
> class Organization < Taxonomy
>
> has_and_belongs_to_many :locations
>
>
> The problem you were problem facing is that Rails 4 changes the naming
> convention of the join table.
>
>
> class Location < Taxonomy
>
> has_and_belongs_to_many :organizations, *join_table:
> :locations_organizations*
>
>
>
> class Organization < Taxonomy
>
> has_and_belongs_to_many :locations, *join_table:
> :locations_organizations*
>
>
>
> Otherwise it will look for a table '*location_organizations*' (NO 's')
> and fail.
>
> I would not include the relationship between Location / Organization in
> taxable_taxonomies.
>
> Joseph
>
>
>
Tom,
Are you sure? I'm pretty sure it would look for locations_organizations and not taxonomies_taxonomies unless I'm missing something.
Joseph
···
----- Original Message -----
From: “Tom Caspy” tcaspy@gmail.com
To: foreman-dev@googlegroups.com
Cc: tcaspy@redhat.com
Sent: Monday, December 22, 2014 3:22:15 PM
Subject: [foreman-dev] Re: Rails 4 has_and_belongs_to_many – locations &
organizations
yup. it actually looked for taxonomies_taxonomies, which makes even less
sense…
Thanks, Joseph!
On Thursday, December 18, 2014 9:15:25 AM UTC+2, Joseph Magen wrote:
Hi Tom,
Per the discussion on irc regarding the Rails 4 branch, note that there is
a
separate join table ‘locations_organizations’ to handle:
class Location < Taxonomy
has_and_belongs_to_many :organizations
class Organization < Taxonomy
has_and_belongs_to_many :locations
The problem you were problem facing is that Rails 4 changes the naming
convention of the join table.
class Location < Taxonomy
has_and_belongs_to_many :organizations, join_table: :
locations_organizations
class Organization < Taxonomy
has_and_belongs_to_many :locations, join_table: : locations_organizations
Otherwise it will look for a table ’ location_organizations ’ (NO ‘s’) and
fail.
I would not include the relationship between Location / Organization in
taxable_taxonomies.
Joseph
–
You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com .
For more options, visit https://groups.google.com/d/optout .