daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. controller:
  2.  
  3. def invite_friends
  4.    
  5.      params[:referraljs].each do |p|
  6.        p.store("user_id" ,  current_user.id)
  7.        p.store("message" ,  object_params[:message])
  8.        referral =  Referral.create(p);
  9.  
  10.        if referral.valid?
  11.     delete_task('invite_friends')
  12.          
  13.          user = UserMailer.deliver_advise_fzp!(current_user, p["email"] , object_params[:message] , p["title"] + ' ' + p["firstname"] + ' ' + p["lastname"]);
  14.        flash[:success] = 'Ihr(e) Freund(e) wurde(n) benachrichtigt!'
  15.       end
  16.     end
  17.    
  18.   redirect_to :back
  19.      
  20.    
  21.   end
  22.  
  23. model:
  24. class Referral < ActiveRecord::Base
  25.  
  26.   belongs_to :user
  27.   attr_accessor :name
  28.   validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i , :message    => 'E-Mail-Adresse muss valide sein!'
  29.   validates_presence_of :email
  30.   validates_presence_of :firstname
  31.   validates_presence_of :lastname
  32.  
  33. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top