I have a simple has_many setting through relationships:
class Tag < ActiveRecord::Base
has_many :profile_tags
has_many :profiles, :through => :profile_tags
end
class ProfileTags < ActiveRecord::Base
belongs_to :profile
belongs_to :tag
end
class Profile < ActiveRecord::Base
has_many :profile_tags
has_many :tags, :through => :profile_tags
end
In my opinion, I accept a set of tags (only strings) and repeat them in my controller and call Tag.create (...) on each of them and pushing them into an array. All of this works great.
So, I get to the point where I have the tag array objects (tags) that were returned by the call to create, and the @profile variable created using Profile.new
I'd like to do: @profile.tags = tags
This causes this error on the line where I am trying to execute the assignment:
uninitialized constant Profile::ProfileTag
Rails , , http://guides.rubyonrails.org/association_basics.html#the-has_many-through-association , , , , .
, ?