Rails idioms (just clever, clever code)#

.#

#

def display(resource, given_options = {})
    controller.render given_options.merge!(options).merge!(format => resources)
end
# Check whether the resource has errors
def has_errors?
    resource.respond_to?(:errors) && !resource.errors.empty?
end
# By default, render the <code>:edit</code> action for HTML requests
# with failure, unless the verb is POST
def default_action
    @action ||= ACTIONS_FOR_VERBS[request.request_method_symbol]
end

#

class UsersContoller < ApplicationController
    protected
    def view_assigns
        {}                      # just returns an empty hash
    end
end

'assigns' references the group of variables available in the controller that will be accessible in the view. Whenever you set an instance variable in your controller as @posts = Post.all, @posts is marked as an 'assign' and will be available in your views.