Hi,
I've done a quick search and haven't found any info on this topic, my
apologies if this has already been addressed before.
Given the following two activerecord models:
N::A and N::B
module N
class A
has_one :b
endend
module N
class B
belongs_to :a
endend
Since the two models are in the same namespace, has_one and belongs_to (or
any other association) work fine with simply :a and :b.
However, the naming convention between the models and foreign keys is
inconsistent.
The ActiveRecord model tables, by default are:
n_a for N::A
n_b for N::B
However, the foreign key for A::B is:
a_id
To keep things consistent, shouldn't the default foreign key be n_a_id
instead?
Issue on GitHub: https://github.com/rails/rails/issues/6731
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-core/-/-0Dlko6JY1QJ.
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/rubyonrails-core?hl=en.