Sha256: f535f9b2e9b54f1faae0454e7a2c015ca5f4154069aa0e994dff8b9d08f72975
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
class NinshoController < Ninsho.parent_controller.constantize helpers = %w(resource resource_name resource_class resource_params) hide_action *helpers helper_method *helpers def flash_message(key, action) message = I18n.t("ninsho.sessions.#{action}") flash[key] = message if message.present? end # Gets the actual resource stored in the instance variable def resource instance_variable_get(:"@#{resource_name}") end def resource_params env['omniauth.auth'] end # Proxy to ninsho map name def resource_name Ninsho.resource_name #authentication end def resource_class Ninsho.resource_class end # Sets the resource creating an instance variable def resource=(new_resource) instance_variable_set(:"@#{resource_name}", new_resource) end # Parent resource def parent_resource resource_class.reflect_on_all_associations(:belongs_to).first.name.to_s end # Build a ninsho resource. # Assignment bypasses attribute protection when :unsafe option is passed def build_resource_from_omniauth self.resource = resource_class.from_omniauth(resource_params) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ninsho-0.0.1 | app/controllers/ninsho_controller.rb |