Created
September 30, 2010 02:36
-
-
Save oren/603928 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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