Created
          April 14, 2014 17:22 
        
      - 
      
- 
        Save laser/10667113 to your computer and use it in GitHub Desktop. 
    Microservices
  
        
  
    
      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
    
  
  
    
  | class User < ActiveRecord::Base | |
| after_create :notify_added | |
| validates :email, uniqueness: true | |
| def notify_added | |
| UserMailer.email(self).deliver | |
| end | |
| end | 
  
    
      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
    
  
  
    
  | class UsersController < ApplicationController | |
| def index | |
| @users = User.all | |
| end | |
| def new; end | |
| def create | |
| User.new(user_params).save! | |
| redirect_to action: 'index' | |
| end | |
| private | |
| def user_params | |
| params.require(:user).permit(:full_name, :phone_number, :email) | |
| end | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment