2013-05-15 2 views

답변

2

내가 왜 코드가 표시되지 않지만 :

Post.rb

class Post < ActiveRecord::Base 
    attr_accessible :body, :name, :song_id, :user_id, :artist_id, :type 
    belongs_to :song 
    belongs_to :user 
    belongs_to :artist 
end 

class Picture < Post 
end 

Picture.rb

그리고 마지막으로 컨트롤러 : 여기 내 코드입니다 너는 일하지 않을거야, 더 잘할거야.

@picture = Picture.new(params[:picture])

:type은 자동으로 "Picture"으로 설정됩니다.