Reputation: 2866
I've tried a bunch of variations of this migration file:
class CombineTags < ActiveRecord::Migration
def change
create_join_table :habits, :valuations, :quantifieds, :goals do |t|
t.timestamps null: false
end
t.index :habits, [:habit_id, :tag_list], :valuations, [:valuation_id, :tag_list], :quantifieds, [:quantified_id, :tag_list] :goals, [:goal_id, :tag_list]
end
end
but I keep getting this error upon running rake db:migrate
:
Anthony-Gallis-MacBook-Pro:pecoce galli01anthony$ rake db:migrate
== 20150506172844 CombineTags: migrating ======================================
-- create_join_table(:habits, :valuations, :quantifieds, :goals)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
wrong number of arguments (4 for 2..3)/Users/galli01anthony/.rvm/gems/ruby-2.1.3/gems/activerecord-4.2.0.rc3/lib/active_record/connection_adapters/abstract/schema_statements.rb:248:in `create_join_table'
This is just one step in trying to achieve my ultimate goal: How to use multiple models for tag_cloud?
Upvotes: 0
Views: 44
Reputation: 176
The create_join_table accept only 3 args (last of them is optionals, look at link). So, you can't create join table for 3 tables use this method.
In you case you should create join table use create_table and specify correspond reference fields.
Upvotes: 1