This commit is contained in:
parent
3452a81971
commit
467545c85a
|
|
@ -1,7 +1,8 @@
|
|||
class Article < ActiveRecord::Base
|
||||
|
||||
belongs_to :user, :foreign_key => 'created_by'
|
||||
|
||||
before_create :b_create
|
||||
before_update :b_update
|
||||
before_destroy :b_destroy
|
||||
|
||||
def b_create
|
||||
|
|
@ -12,7 +13,7 @@ class Article < ActiveRecord::Base
|
|||
#ToDo destroy comments
|
||||
end
|
||||
|
||||
def self.created
|
||||
"#{self.email} (#{self.created_at})"
|
||||
def created
|
||||
"#{self.user.email} (#{self.created_at})"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
class User < ActiveRecord::Base
|
||||
|
||||
has_many :articles, :foreign_key => 'created_by'
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||
devise :database_authenticatable, :registerable,
|
||||
|
|
|
|||
Loading…
Reference in New Issue