lib/happy/extras/resources.rb in happy-0.1.0.pre19 vs lib/happy/extras/resources.rb in happy-0.1.0.pre20
- old
+ new
@@ -1,7 +1,5 @@
-require 'happy/extras/permissions'
-
module Happy
module Extras
module Resources
module ControllerExtensions
def resource(klass, options = {}, &blk)
@@ -29,22 +27,22 @@
def require_permission!(*args)
raise "not allowed" unless permissions.can?(*args, options[:class])
end
def set_plural_variable(v)
- context.instance_variable_set "@#{options[:plural_name]}", v
+ instance_variable_set "@#{options[:plural_name]}", v
end
def plural_variable
- context.instance_variable_get "@#{options[:plural_name]}"
+ instance_variable_get "@#{options[:plural_name]}"
end
def set_singular_variable(v)
- context.instance_variable_set "@#{options[:singular_name]}", v
+ instance_variable_set "@#{options[:singular_name]}", v
end
def singular_variable
- context.instance_variable_get "@#{options[:singular_name]}"
+ instance_variable_get "@#{options[:singular_name]}"
end
def do_index
require_permission! :index
set_plural_variable resource_with_permission_scope(:index).all