こんにちは、attr_accessible などを使用する必要があります。そして、Ruby On Rails の初心者です。
それは私のpost.rb
ファイルです
class Post < ActiveRecord::Base
has_many :comments
attr_accessible :body, :title, :published, :author, :author_id
belongs_to :author, :class_name => "AdminUser"
validates_presence_of :body,:title
scope :published, where(:published => true)
def content
MarkdownService.new.render(body)
end
def author_name
if author
author.name
else
"Nobody"
end
end
end
あなたの答えに感謝します。