journalduhacker/app/controllers/invitations_controller.rb

21 lines
508 B
Ruby
Raw Normal View History

2012-07-01 20:31:31 +02:00
class InvitationsController < ApplicationController
before_filter :require_logged_in_user
def create
i = Invitation.new
i.user_id = @user.id
i.email = params[:email]
i.memo = params[:memo]
if i.save
2012-07-03 18:59:50 +02:00
i.send_email
2012-07-01 20:31:31 +02:00
flash[:success] = "Successfully e-mailed invitation to " <<
2012-07-04 05:31:42 +02:00
params[:email].to_s << "."
2012-07-01 20:31:31 +02:00
else
flash[:error] = "Could not send invitation, verify the e-mail " <<
"address is valid."
end
return redirect_to "/settings"
end
end