license_models_controller.rb revision 80bec0e081f3ea13eec9ef8ea50a9ccbb74fcb46
class LicenseModelsController < InheritedResources::Base
belongs_to :ontology, optional: true
before_filter :check_read_permissions
load_and_authorize_resource
def create
create! do |format|
if parent
parent.license_models << resource
parent.save
end
format.html { redirect_to [*resource_chain, :license_models] }
end
end
def update
update! do |format|
format.html { redirect_to [*resource_chain, :license_models] }
end
end
def destroy
destroy! do |format|
format.html { redirect_to [*resource_chain, :license_models] }
end
end
private
def check_read_permissions
authorize! :show, parent.repository if parent.is_a? Ontology
end
end