| Module | ResourceController::Helpers::SingletonCustomizations |
| In: |
lib/resource_controller/helpers/singleton_customizations.rb
|
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
Singleton controllers don‘t build off of association proxy, so we can‘t use end_of_association_chain here