This repository has been archived on 2024-08-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
redstoner.com/app/models/blogpost.rb
2013-06-25 02:53:12 +02:00

16 lines
320 B
Ruby

class Blogpost < ActiveRecord::Base
attr_accessible :title, :text
validates_presence_of :title, :text, :user
belongs_to :user
has_many :comments
accepts_nested_attributes_for :comments
def author
@author ||= if user.present?
user
else
User.find_by_name("Deleted user")
end
end
end