lib/portier/application_permission.rb in portier-1.0.3 vs lib/portier/application_permission.rb in portier-1.1.0
- old
+ new
@@ -63,18 +63,22 @@
nil
end
end
def model
- controller_name.singularize.camelize.constantize
+ model_name.camelize.constantize
end
+ def model_name
+ controller_name.split('/').last.singularize
+ end
+
def model_exists?
defined? model
end
def record_name
- controller_name.singularize.to_sym
+ model_name.to_sym
end
def method_missing(*args, &block)
if args.first == record_name and model_exists?