2014-04-01 2 views
0

post 모델은 Rails 4 앱에 accepts_nested_attributes_for :slide이라는 단순한 모델이 있습니다. 모든 것이 설정 및 dev에 모드에서 내 로컬 컴퓨터에 벌금을 실행이지만 Heroku가 디지털 바다 서버 모두에서이 오류가 발생합니다 :이 문제의 컨트롤러 라인입니다레일 4 has_one/accepts_nested_attributes는 로컬에서 작동하지만 서버에서는 작동하지 않습니다.

app/web.1: ActiveRecord::UnknownAttributeError (unknown attribute: post_id): 
app/web.1: app/controllers/posts_controller.rb:12:in `new' 

, 위에서 언급 한 라인 (12)은 3입니다 라인은 아래 :

def new 
    @post = Post.new 
    @post.build_slide 
end 

나는 검사 두 배 내 서버 나에게 Heroku에 보류중인 마이그레이션이 없습니다 모두가 최신 망할 놈의 repo에 있습니다. 로컬 dev 및 원격 repos 모두 postgres를 실행하고 있습니다. 모든 것이 irb에서도 체크 아웃됩니다.

2.0.0-p247 :001 > a = Post.new 
=> #<Post id: nil, title: nil, en_body: nil, ko_body: nil, short_title: nil, created_at: nil, updated_at: nil, published: nil, slug: nil, ko_title: nil> 
2.0.0-p247 :002 > a.build_slide 
=> #<Slide id: nil, en_title: nil, ko_title: nil, en_description: nil, ko_description: nil, active: false, created_at: nil, updated_at: nil, image_file_name: nil, image_content_type: nil, image_file_size: nil, image_updated_at: nil, link: nil, anchor: nil, post_id: nil> 

왜 서버가 알 수없는 속성에 대해 불평 할 수 있습니까?

+1

서버를 다시 시작 하시겠습니까? 한 번 나 heroku에서 나에게 일어난 일이 있습니다. 마이그레이션을 수행 한 후 heroku 서버를 다시 시작해야했습니다. 레일즈 앱 디렉토리에서 'heroku restart'를 사용하여 heroku 서버를 다시 시작하십시오. –

+0

건배, 그 고정 된 heroku. 여전히 서버가 다시 시작될 때까지 기다리는 중입니다 ... 디지털 바다는 현재 몇 가지 문제가있는 것으로 보입니다. – user2936314

+0

나는 디지털 바다에서의 이슈에 대해 알고 있지 않습니다. 하지만 서버가 다시 시작되면 문제가 해결 될 것이라고 확신합니다. 내 문제를 해결할 때 답을 정확하게 표시해 주시겠습니까? –

답변

0

heroku 서버를 다시 시작하십시오. heroku에서 나에게 일어난 일은 입니다. 마이그레이션을 수행 한 후 heroku 서버를 다시 시작해야했습니다. 당신의 레일에서

heroku restart 

응용 프로그램 디렉토리를 사용 다시 시작 Heroku가 서버입니다.

관련 문제