I have two models enterprise and deal_event with habtm association. This relation works with create and when I do
Enterprise.last.deal_events
but throws error
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "deal_events_enterprises" does not exist LINE 1: ...CT "enterprises".* FROM "enterprises" INNER JOIN "deal_even...
when I do
DealEvent.last.enterprises
My models
enterprise.rb
has_and_belongs_to_many :deal_events
deal_event.rb
has_and_belongs_to_many :enterprises
migration
class CreateDealEventsEnterprisesJoinTable < ActiveRecord::Migration[5.1]
def change
create_join_table :deal_events, :enterprises do |t|
t.index :deal_event_id
t.index :enterprise_id
end
end
end