Module: Lasso::Controller::InstanceMethods

Defined in:
lib/lasso/controller/instance.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/lasso/controller/instance.rb', line 9

def create
  @owner = oauth_settings[:through].bind(self).call
  @oauth = type.new(:service => params[:service], :owner => @owner)
  parse_response
  if @oauth.duplicate
    if @owner.nil? || @owner.new_record?
      send(oauth_settings[:login], @oauth.duplicate.owner)
    elsif @owner == @oauth.duplicate.owner
      @oauth.duplicate.destroy
      save_the_oauth
    else
      send(oauth_settings[:conflict], @oauth.duplicate.owner)
    end
  else
    save_the_oauth
  end
end

#newObject



4
5
6
7
# File 'lib/lasso/controller/instance.rb', line 4

def new
  @oauth = type.new(:service => params[:service])
  redirect
end