if statement - IF Else Using Ruby Logic depending on Params sent in -
am sending in parameters @ bottom of posting getting posted load instead of hotload
can see doing wrong here...
i sending in parameter of hotload should change post_type hotload
class majorposter @queue = :major_posters_posting def self.perform(_post) post_clone = _post.clone post_type = load post_type = hotload if (_post[:hotload]) post_type = truck if (_post[:available]) begin result = post_type.send("post",_post) rescue => detail resque.enqueue(secondchance, { :queue => "major_posters_posting", :post => post_clone, :exception_class => detail.class.to_s, :exception_str => detail.to_s }) else notification.check(result.id, post_type) #todo end end end
log file of params being sent in...
{:equipment_id=>34, :comments=>"9145662 ~load max~", :user_id=>"10181", :origin=>"cy of industry, ca", :dest=>"loveland, co", :pickup=>2014-07-08 12:00:00 -0500, :delivery=>2014-07-10 12:00:00 -0500, :rate=>"call", :length=>"53", :hotload=>"true"} {:equipment_id=>34, :comments=>"9163608 ~load max~", :user_id=>"10181", :origin=>"auburndale, fl", :dest=>"paw paw, mi", :pickup=>2014-07-06 12:00:00 -0500, :delivery=>2014-07-09 12:00:00 -0500, :rate=>"call", :length=>"53", :hotload=>"true"} {:equipment_id=>34, :comments=>"9158096 ~load max~", :user_id=>"10181", :origin=>"auburndale, fl", :dest=>"paw paw, mi", :pickup=>2014-07-03 12:00:00 -0500, :delivery=>2014-07-06 12:00:00 -0500, :rate=>"call", :length=>"53", :hotload=>"true"} {:equipment_id=>34, :comments=>"9163315 ~load max~", :user_id=>"10181", :origin=>"auburndale, fl", :dest=>"paw paw, mi", :pickup=>2014-07-03 12:00:00 -0500, :delivery=>2014-07-06 12:00:00 -0500, :rate=>"call", :length=>"53", :hotload=>"true"}
the keys of params sending symbols, not strings - should change code accordingly:
def self.perform(_post) post_clone = _post.clone post_type = load post_type = hotload if (_post[:hotload]) post_type = truck if (_post[:available]) # ...
Comments
Post a Comment