ruby on rails - Where do I put model so that whenever could access them? -


simple , maybe stupid question. where? simple generated model in /models doesn't work, , new class in /lib doesn't also... errors undefined methods etc.

schedule.rb

every '* * * * *' runner 'updatedaysago.test' end 

model

class updatedaysago < activerecord::base   def test     updatedaysago.create(channel: "nil", title: "nil", game: "nil", avatar: "nil", created_at: time.now, updated_at: time.now)   end end 

error

/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.2.1/lib/active_record/dynamic_matchers.rb:26:in `method_missing': private method `test' called #<class:0x00000004db7b40> (nomethoderror) 

whenever works fine, cron jobs on command good. have no idea models , runner :/

you should create class method:

class updatedaysago < activerecord::base   def self.test     updatedaysago.create(channel: "nil", title: "nil", game: "nil", avatar: "nil", created_at: time.now, updated_at: time.now)   end end 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -