お世話になっています。
現在、RubyOnRailsでデータベースを構築しているのですが
何回やっても、「rake db:migrate」が実行されず、エラーが出てしまいます。
Ruby
1class CreateProjects < ActiveRecord::Migration 2 def change 3 create_table :projects do |t| 4 t.has_many :users 5 t.belongs_to :product 6 7 t.string :title 8 9 t.datetime :deadline 10 t.datetime :project_date 11 t.integer :goal_amount 12 13 t.attachment :image 14 15 t.timestamps null: false 16 end 17 end 18end
== 20160402173641 CreateProjects: migrating =================================== -- create_table(:projects) rake aborted! StandardError: An error has occurred, this and all later migrations canceled: undefined method `has_many' for #<ActiveRecord::ConnectionAdapters::PostgreSQL::TableDefinition:0x007f85909ce510> /Users/***/db/migrate/20160402173641_create_projects.rb:4:in `block in change' /Users/***/db/migrate/20160402173641_create_projects.rb:3:in `change' NoMethodError: undefined method `has_many' for #<ActiveRecord::ConnectionAdapters::PostgreSQL::TableDefinition:0x007f85909ce510> /Users/***/db/migrate/20160402173641_create_projects.rb:4:in `block in change' /Users/***/db/migrate/20160402173641_create_projects.rb:3:in `change' Tasks: TOP => db:migrate (See full trace by running task with --trace)
開発環境:Ruby On Rails
データベース:posql
おたすけくださいませ。
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/05/01 16:46