Displaying 4 results from an estimated 4 matches for "find_or_create_by_email".
2008 Feb 07
1
ActiveRecord 'find_or_initialize_by' dynamic finder bug? Ignoring conditions.
...passive''})
User Load (0.000425) SELECT * FROM `users` WHERE (`users`.`email`
= ''foo-+RB1Aph5k6s@public.gmane.org'') AND (`users`.`state` = ''passive'')
=> []
## EXAMPLE : find_or_(create|initialize)_by_* IGNORES CONDITIONS ##
>> @user = User.find_or_create_by_email(''foo-+RB1Aph5k6s@public.gmane.org'', :conditions => {:state => ''passive''})
User Load (0.000436) SELECT * FROM `users` WHERE (`users`.`email`
= ''foo-+RB1Aph5k6s@public.gmane.org'') LIMIT 1
>> @user = User.find_or_initialize_by_emai...
2009 Nov 17
2
rake db:seed with authlogic fails to populate users
I have a db/seeds.rb file that I want to load, but while the rest of the
seeds file works fine, nothing is ever populated in :users. I just fails
silently, so I can''t figure out what exactly is causing the problem.
I have authlogic installed into the user.rb model with
acts_as_authentic. I''m sure that''s part of the problem, but I''m not sure
that manually
2009 Apr 23
8
how to avoid (Net::SMTPFatalError) "555 5.5.2 Syntax error
...gnation],params[:company],params[:id],@invitation.invitation_code)
this method , and in mass_notifier.rb
I fave written
def
forward_review_link(sender,recipients,message,title,designation,company,id,code)
return if UnsubscribedEmail.find_by_email(recipients)
@unsubscribe_code = MailingList.find_or_create_by_email(recipients)
if @unsubscribe_code.code.nil?
@unsubscribe_code.code = Digest::SHA1.hexdigest(
Time.now.to_s.split(//).sort_by {rand}.join )
@unsubscribe_code.save
end
@body[:unsubscribe_link] = "<a
href=''http://www.somelink.com/unsubscribe/#{@unsubscribe_cod...
2006 Apr 25
14
validate_on_update with a save()
I''ve got a form with inputs like user[first_name], user[last_name], etc.
When editing the user instead of creating a new one I include a
user[id]. I then try and save the object using:
user = User.new(params[:user])
user.save()
I would *expect* that since I included the user[id] it should do an
update and should call validate_on_update. But this doesn''t appear to
be the