Module ResourceController::Helpers::SingletonCustomizations
In: lib/resource_controller/helpers/singleton_customizations.rb

Methods

Public Class methods

Protected Instance methods

Builds the object, but doesn‘t save it, during the new, and create action.

Used to fetch the current object in a singleton controller.

By defult this method is able to fetch the current object for resources nested with the :has_one association only. (i.e. /users/1/image # => @user.image) In other cases you should override this method and provide your custom code to fetch a singleton resource object, like using a session hash.

class AccountsController < ResourceController::Singleton

  private
    def object
      @object ||= Account.find(session[:account_id])
    end
  end

Used internally to provide the options to smart_url in a singleton controller.

Returns the :has_one association proxy of the parent. (i.e. /users/1/image # => @user.image)

Singleton controllers don‘t build off of association proxy, so we can‘t use end_of_association_chain here

[Validate]