2016-07-28 5 views
1

이 문제에 관해서 아무 것도 없습니다. 레일 마이그레이션이 레이크 마이그레이션 오류 MaBase가 클래스가 아닙니다.

을 MaBase 생성 그리고 나는 *의 _ma_base.rb 그

class MaBase < ActiveRecord::Migration 
    def change 
     create_table :connexion 
     add_column :connexion, :ip, :string 
     add_column :connexion, :user_agent, :string 
     add_column :connexion, :nb, :integrer 
     add_column :connexion, :date, :datetime 
     create_table :recherche 
     add_column :recherche, :ip, :string 
     add_column :recherche, :recherche, :string 
     add_column :recherche, :date, :datetime 
     create_table :membre 
     add_column :membre, :ip, :string 
    end 
end 

처럼 작성하고 난 오류가 발생합니다 : 나는 이런 식으로 마이그레이션을 만들 수 있습니다.

는 여기에 몇 가지 주제를 읽은 후, 나는 이러한 종류의 코드와 모델 ma_base.rb에서 파일을 만들 만들 :

class MaBase < ActiveRecord::Base 

end 

그러나 오류가 여기 STIL 지원

감사하다

답변

0

이동 파일의 class 이름을 MaBase에서 MaBases으로 변경하십시오. Activerecord는 model의 복수형을 db 파일에 매핑합니다.

class MaBases < ActiveRecord::Migration 
+0

감사하지만 지금은 다른 오류를 얻을 :이 시도 NoMethodError을 : MaBase위한 ''새로운 정의되지 않은 방법 : 새 개체를 만들 때 모듈 – user3279327

+0

는이 오류를받을 수 있나요? – titan

+0

아니요 그냥 rake db를 실행할 때 : addind "후에 – user3279327

관련 문제