search for: generate_token

Displaying 3 results from an estimated 3 matches for "generate_token".

2010 Feb 09
2
undefined method `generate_token'
Hi Everyone... I''m following a railscast episode on how to implement an invitation feature. It''s going really well, but i''ve hit a minor snag that I cant get over.. undefined method `generate_token'' for #<Invitation:0x2563bf8> The invite form allows me to check for a user, and whether they already have registered. If they have, the invitation is not sent, and a flash message is printed. If the email does not exist, the invite count (starts at 5) decrements until you have none...
2011 Mar 17
7
Beta Invitation in Rails 3, little problem
...se belongs_to :sender, :class_name => ''User'' has_one :recipient, :class_name => ''User'' email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :recipient_email, :presence => true, :format => { :with => email_regex } before_create :generate_token private def generate_token self.token = Digest::SHA1.hexdigest([Time.now, rand].join) end end #/mailers/invitation.text.rb You are invited to ExampleApp.com click below to signup <%= @signup_url %> # models/mailer.rb class Invitation < ActionMailer::Base default :from =>...
2010 Feb 10
16
nil object - can anyone help?
...gt; ''User'' has_one :recipient, :class_name => ''User'' ###validation validates_presence_of :recipient_email validate :recipient_is_not_registered validate :sender_has_invitations, :if => :sender before_create :generate_token before_create :decrement_sender_count, :if => :sender private def recipient_is_not_registered errors.add :recipient_email, ''Is already registered'' if User.find_by_email(recipient_email) end def sender_has_invitations unless sender.invitations_limit &...