ruby on rails - Error when submitting custom mail process (whenever plugin) -
Whenever I'm trying to use the plugin to process a model for some time on the rail
When I try to use the mail-out process in my user model, I get the following error: Can someone tell me in the right direction of being wrong?
/war/lib/gems/lk8/gems/rels-2k3k5/lib/commands/rnrkrb: 48: /war/lib/gems/lk8/gems/aktiverekord- 2.3.5 / lib / active_record / base.rb: 1567: in 'find_from_ids': could not find the user without the ID (ActiveRecord :: RecordNotFound) from / Var / lib / gems / 1.8 / gems / activerecord-2.3.5 / lib / active_record / base.rb: 616: in `search 'from /home/tnederlof/Dropbox/Ruby/daily_trailer/app/models/user.rb: 9: the` Mel_aut' (eval): 1 / usr / lib In 'eval' from /ruby/1.8/rubygems/custom_require.rb31:in/var/lib/gems/1.8/gems/rails-2.3. 5 / lib / command / runner.rb: from 48 /usr/lib/ruby/1.8/rubygems/custom_require.rb31:in/em/lib/ruby/1.8/rubygems/custom_require.rb31 in `gem_original_require ': script / runner From `Required 'to: 3
My schedule. RB is as follows:
every 1.day, at => '5:30 am' runner "user.mail_out" end
My user model is:
class user & lt; ActiveRecord :: Base works_ass_authorized default self.mail_out day of the week = date. ('% a'). Downcases @ user = search (: conditions => "# {workdays} sub = T") @ users.each {| You UserMailer.deliver_mail_out (u)} End End
My User_mailer is:
Class UserMailer & lt; ActionMailer :: Base def mail_out (user) @recipients = {} users.each do | User | @recipients [user.email] = {: name = & gt; User.name} "no-reply@dailytrailer.net" ends with the theme "Watch the Day Trailer!" Body: user = & gt; End of user end
Migration:
create_table "users" ,: force = & gt; Is true T | T.string "email" t.date "birthday" t.string "gender" t.string "zipcode" t.datetime "created_at" t.datetime "updated_at" t.string "crypted_password" t.string "password_salt" t. String "persistence_token" t.string "mondaysub" ,: default = & gt; "F" ,: null = & gt; Wrong t.string "tuesdaysub" ,: default = & gt; "F" ,: null = & gt; False t String "wednesdaysub" ,: default => "F" ,: null = & gt; Wrong t.string "thursdaysub" ,: default = & gt; "F" ,: null = & gt; Wrong t.string "fridaysub" ,: default = & gt; "F" ,: null = & gt; Wrong t.string "saturdaysub" ,: default => "F" ,: null = & gt; Wrong t.string "sundaysub" ,: default = & gt; "F" ,: null = & gt; False end
Change this:
Find ( : Terms = & gt; Find all (= all, terms = & gt; "## {workdays} subtype = T")
to
# {Day of week} subt = t ")
Comments
Post a Comment