Sha256: bf4e46393a1a3ac1ff87d6869828976902fb7b7418f416c5c29b1817c5bb3eb0
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
# @author Tobias Feistmantl # # Helper methods for your controller # to identify RESTful actions. module ActionControl # @return [Boolean] # True if the called action # is a only-read action. def read_action? action_name == "index" || action_name == "show" end # @return [Boolean] # True if the called action # is a write action. def write_action? action_name == "new" || action_name == "create" || action_name == "edit" || action_name == "update" || action_name == "destroy" end # @return [Boolean] # True if the called action # is a change action. def change_action? action_name == "edit" || action_name == "update" || action_name == "destroy" end # @note # Also true for the pseudo # update action `new`. # # @note # Only true for create methods # such as new and create. # # @return [Boolean] # True if the called action # is a create action. def create_action? action_name == "new" || action_name == "create" end # @note # Also true for the pseudo # update action `edit`. # # @return [Boolean] # True if the called action # is a update action. def update_action? action_name == "edit" || action_name == "update" end # @return [Boolean] # True if it's a destroy action. def destroy_action? action_name == "destroy" end alias delete_action? destroy_action? end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
action_control-0.0.3 | lib/action_control/controller_methods.rb |
action_control-0.0.2 | lib/action_control/controller_methods.rb |