I am trying to do a join table. My first table is called web_forms with column account_id. Second table is called required_fields with column web_form_id.
I am currently getting the error...
RequiredFields.find(226) ActiveRecord::RecordNotFound: Couldn't find RequiredField with id=226
class WebForm < ActiveRecord::Base
has_many :required_fields,
class_name: RequiredField,
foreign_key: :web_form_id
end
class RequiredField < ActiveRecord::Base
has_and_belongs_to_many :web_forms,
class_name: WebForm,
foreign_key: :web_form_id,
association_foreign_key: :account_id
end
I read through this and it confused me more.
http://guides.rubyonrails.org/association_basics.html#has-and-belongs-to-many-association-reference
Any help would be great thanks.