Module: Opinio::Controllers::Extensions::InstanceMethods

Defined in:
lib/opinio/controllers/extensions.rb

Instance Method Summary collapse

Instance Method Details

#can_destroy_opinio?(opinio) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/opinio/controllers/extensions.rb', line 25

def can_destroy_opinio?(opinio)
  self.instance_exec(opinio, &Opinio.destroy_conditions)
end

#opinio_after_create_path(resource) ⇒ Object



29
30
31
# File 'lib/opinio/controllers/extensions.rb', line 29

def opinio_after_create_path(resource)
  resource.is_a?(Opinio.model_name.constantize) ? resource.commentable : resource
end

#opinio_after_destroy_path(comment) ⇒ Object



33
34
35
# File 'lib/opinio/controllers/extensions.rb', line 33

def opinio_after_destroy_path(comment)
  comment.commentable
end