add access methods for delete
This commit is contained in:
parent
ebc803a88a
commit
8618ad3ede
|
@ -28,6 +28,16 @@ class JournalsForMessage < ActiveRecord::Base
|
||||||
|
|
||||||
# default_scope { where('m_parent_id IS NULL') }
|
# 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)
|
def self.delete_message(message_id)
|
||||||
self.find(message_id).destroy
|
self.find(message_id).destroy
|
||||||
# self.destroy_all "id = #{message_id}"
|
# self.destroy_all "id = #{message_id}"
|
||||||
|
|
Loading…
Reference in New Issue