Skip to content

Instantly share code, notes, and snippets.

@brianjlandau
Created January 31, 2010 04:52
Show Gist options
  • Save brianjlandau/290911 to your computer and use it in GitHub Desktop.
Save brianjlandau/290911 to your computer and use it in GitHub Desktop.
diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb
index bb9e1dc..68a898d 100644
--- a/app/controllers/invitations_controller.rb
+++ b/app/controllers/invitations_controller.rb
@@ -1,20 +1,16 @@
class InvitationsController < ApplicationController
+ before_filter :require_analyst
+
def new
@invitation = Invitation.new
end
def create
@invitation = Invitation.new(params[:invitation])
- @invitation.sender = @current_user
+ @invitation.sender = current_analyst
if @invitation.save
- if logged_in?
- Mailer.deliver_invitation(@invitation, signup_url(@invitation.token))
- flash[:notice] = "Thank you, invitation sent."
- redirect_to projects_url
- else
- flash[:notice] = "Thank you, we will notify when we are ready."
- redirect_to root_url
- end
+ flash[:notice] = "Thank you, invitation sent."
+ redirect_to root_url
else
render :action => 'new'
end
diff --git a/app/models/invitation.rb b/app/models/invitation.rb
index 7efde20..2bf039f 100644
--- a/app/models/invitation.rb
+++ b/app/models/invitation.rb
@@ -1,4 +1,4 @@
class Invitation < ActiveRecord::Base
acts_as_invitation :user_class_name => 'Analyst'
- attr_accessible :recipient_email
+ attr_accessible :recipient_email, :sender, :sender_id
end
diff --git a/config/environment.rb b/config/environment.rb
index 5a9adde..5d8d532 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -31,7 +31,7 @@ Rails::Initializer.run do |config|
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
-
+ config.action_mailer.default_url_options = {:host => 'somewhere.com'}
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment