lib/auth_helpers/controller/helpers.rb in josevalim-auth_helpers-0.4.1 vs lib/auth_helpers/controller/helpers.rb in josevalim-auth_helpers-0.5.0
- old
+ new
@@ -2,10 +2,11 @@
module Controller
module Helpers
def self.included(base)
base.extend ClassMethods
+ base.respond_to :html
end
module ClassMethods
protected
@@ -35,29 +36,29 @@
def set_class_accessors_with_class(klass)
self.resource_class = klass
self.instance_name = klass.name.downcase
self.route_name = klass.name.downcase
end
- end
-
+ end
+
protected
- # If a block is given, redirect to the url in the block, otherwise
- # try to call the url given by scope, for example:
+ # Try to call a url using resource object and the scope, for example:
#
# new_account_session_url
# new_account_password_url
#
- def redirect_to_block_or_scope_to(redirect_block, scope) #:nodoc:
- redirect_to redirect_block ? redirect_block.call : send("new_#{self.route_name}_#{scope}_url")
+ def url_by_name_and_scope(scope) #:nodoc:
+ send("new_#{self.route_name}_#{scope}_url")
end
# Try to get the instance variable, otherwise send the args given to
# the resource class and store the result in the same instance variable.
#
def get_or_set_with_send(*args) #:nodoc:
instance_variable_get("@#{self.instance_name}") || instance_variable_set("@#{self.instance_name}", resource_class.send(*args))
end
-
+
end
- end
end
+ end
+end