domainpost.rb で私はこれを持っています:
class Domainpost < ActiveRecord::Base
attr_accessible :content, :additiona, :registerdate, :expiredate, :registerin, :price
belongs_to :user
before_save { |domainpost| domainpost.content = content.downcase }
before_validation :pricecheck
validates :price, allow_blank: false, presence: true
default_scope order: 'domainposts.created_at DESC'
def pricecheck
if price.blank?
price = 'no price'
end
end
そして、保存した後に投稿の価格が空白のままになっていると機能しません。何が間違っているのでしょうか。