add access methods for delete
This commit is contained in:
parent
ebc803a88a
commit
8618ad3ede
|
@ -27,6 +27,16 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
after_destroy :reset_counters!
|
||||
|
||||
# default_scope { where('m_parent_id IS NULL') }
|
||||
|
||||
def remove_by_user? user
|
||||
if( self.user == user ||
|
||||
( self.jour.kind_of?(User) && self.jour== user )
|
||||
)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def self.delete_message(message_id)
|
||||
self.find(message_id).destroy
|
||||
|
|
Loading…
Reference in New Issue