Skip to content

Instantly share code, notes, and snippets.

@oren
Created September 30, 2010 02:36
Show Gist options
  • Select an option

  • Save oren/603928 to your computer and use it in GitHub Desktop.

Select an option

Save oren/603928 to your computer and use it in GitHub Desktop.
def email_to_friend
errors = []
@name = params['email-to-friend']['name']
if @name == ''
errors << "Name is missing"
end
@from = params['email-to-friend']['from']
if @from == ''
errors << "Email is missing"
end
@to = params['email-to-friend']['to']
if @to == ''
errors << "Friend's email is missing"
end
if !errors.empty?
@message = params['email-to-friend']['message']
flash[:error] = errors.join(', ')
@career = Post.find( params['post_id'] )
@title = @career.title
render :action => :show, :status => 206
else
#Mailer.deliver_email_to_friend '[email protected]', params['email-to-friend']
flash[:notice] = 'Your email was sent'
#flash.now[:error] = 'Word verification is incorrect, please try again'
#render :action => :home
redirect_to :back
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment