lib/trust/controller.rb in trust-0.7.0 vs lib/trust/controller.rb in trust-0.8.0
- old
+ new
@@ -36,13 +36,13 @@
# If no properties are instantiated, it will be instantiated
#
# == Delegated methods
#
# The following methods are delegated to properties. See Trust::Controller::Properties for details
- # * <tt>belongs_to</tt> - define one or more associations to parents
- # * <tt>actions</tt> - acion definitions outside the restful actions
- # * <tt>model</tt> - Redefine the model used in the controller (if it's name does not match the
+ # * +belongs_to+ - define one or more associations to parents
+ # * +actions+ - acion definitions outside the restful actions
+ # * +model+ - Redefine the model used in the controller (if it's name does not match the
# controller_path)
#
def properties
@properties ||= Trust::Controller::Properties.instantiate(self)
end
@@ -96,35 +96,35 @@
# Enable or disable +before_filter+ callback for setting the current user
#
# === Arguments:
#
- # :off - switch callback off
- # :only - only include these actions
- # :except - except these actions
+ # +:off+ - switch callback off
+ # +:only+ - only include these actions
+ # +:except+ - except these actions
def set_user(*args)
_filter_setting(:set_user, *args)
end
# Enable or disable +before_filter+ callback for setting the loading resource
#
# === Arguments:
#
- # :off - switch callback off
- # :only - only include these actions
- # :except - except these actions
+ # +:off+ - switch callback off
+ # +:only+ - only include these actions
+ # +:except+ - except these actions
def load_resource(*args)
_filter_setting(:load_resource, *args)
end
# Enable or disable +before_filter+ callback for setting the access control, i.e. verifying permissions
# for the logged in user
#
# === Arguments:
#
- # :off - switch callback off
- # :only - only include these actions
- # :except - except these actions
+ # +:off+ - switch callback off
+ # +:only+ - only include these actions
+ # +:except+ - except these actions
def access_control(*args)
_filter_setting(:access_control, *args)
end
private
@@ -142,13 +142,13 @@
# If no properties are instantiated, it will be instantiated.
#
# == Delegated methods
#
# The following methods are delegated to properties. See Trust::Controller::Properties for details
- # * <tt>belongs_to</tt> - define one or more associations to parents
- # * <tt>actions</tt> - acion definitions outside the restful actions
- # * <tt>model</tt> - Redefine the model used in the controller (if it's name does not match the
+ # * +belongs_to+ - define one or more associations to parents
+ # * +actions+ - acion definitions outside the restful actions
+ # * +model+ - Redefine the model used in the controller (if it's name does not match the
# controller_path)
#
def properties
self.class.properties
end
@@ -194,14 +194,14 @@
#
# If access control is not sufficient in controller, you may use this method.
# Also available as a helper in views.
#
# ==== Examples
- # can? :edit # does the current user have permission to edit the current resource?
- # # If there is a nested resource, the parent is automatically associated
- # can? :edit, @customer # does the current user have permission to edit the given customer?
- # # Parent is also passed on here.
- # can? :edit, @account, @client # is current user allowed to edit the account associated with the client?
+ # +can? :edit+ # does the current user have permission to edit the current resource?
+ # # If there is a nested resource, the parent is automatically associated
+ # +can? :edit, @customer+ # does the current user have permission to edit the given customer?
+ # # Parent is also passed on here.
+ # +can? :edit, @account, @client+ # is current user allowed to edit the account associated with the client?
def can?(action_name, subject = resource.instance || resource.relation.new, parent = resource.parent)
Trust::Authorization.authorized?(action_name, subject, parent)
end
end
end