Conditions | 5 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | class AttendancesController < ApplicationController |
||
45 | def create_participant |
||
46 | return if logged_in? |
||
47 | return if params[:attendance].nil? |
||
48 | |||
49 | name, email, password = params[:attendance][:name], params[:attendance][:email], params[:attendance][:password] |
||
50 | |||
51 | participant_session = ParticipantSession.new(:email => email, :password => password) |
||
52 | if participant_session.save |
||
53 | @current_participant_session = participant_session |
||
54 | else |
||
55 | participant = Participant.new(:name => name, :email => email, :password => password) |
||
56 | if participant.save |
||
57 | @current_participant_session = ParticipantSession.create(participant, true) |
||
58 | else |
||
59 | flash[:error] = "There was a problem creating an account for you. Please try again." |
||
60 | redirect_to new_participant_path |
||
61 | end |
||
62 | end |
||
63 | end |
||
64 | end |
||
65 |