Sha256: 19c8c95049430acfedec8e666ce67e0f436fe5b0ca6b0f6bcdd9a6ed8f43c211
Contents?: true
Size: 982 Bytes
Versions: 2
Compression:
Stored size: 982 Bytes
Contents
require 'ninsho/authentication' module Ninsho module Interface def self.included(base) base.extend(ClassMethods) end def auth_hash Ninsho.resource_class.auth_hash end module ClassMethods attr_accessor :auth_hash def belongs_to_ninsho(*args) options = args.extract_options! associations = args.collect(&:to_s).collect(&:downcase) association_keys = associations.collect { |association| "#{association}_id" } #Set the belongs_to association by ActiveRecord associations.each do |associated_model| belongs_to associated_model.to_sym Ninsho.parent_resource_name = Ninsho.ref(associated_model.to_s.classify).get end end # Responsible for creating or find the record with the # omniauth hash def from_omniauth(omniauth = nil) self.auth_hash = omniauth Ninsho::Authentication.new(omniauth) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ninsho-0.1.1 | lib/ninsho/interface.rb |
ninsho-0.1.0 | lib/ninsho/interface.rb |