Ask A Question


You’re not receiving notifications from this thread.

NoMethodError in TweetsController#create undefined method `publish_at' for nil:NilClass

Adalberto Caldeira asked in Rails

I am new at rails and just complete Chris tutorial in => schedule_tweets. But I could not send any tweet , I did the UTC modification for america/brasilia, when I make a schedule tweet this error is showed in my screen. I am lost. How could I try to fix it ?
after_save_commit do
if publish_at_previously_changed?
TweetJob.set(wait_until: @tweet.publish_at).perform_later(self)

Rails.root: /home/adalberto/Documents/railsForBeginners/scheduled_tweets
Application Trace | Framework Trace | Full Trace
app/models/tweet.rb:16:in block in <class:Tweet>'


"tweet"=>{"twitter_account_id"=>"3", "body"=>"hello", "publish_at(1i)"=>"2021", "publish_at(2i)"=>"2", "publish_at(3i)"=>"18", "publish_at(4i)"=>"20", "publish_at(5i)"=>"21"},

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 81,149+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2024 GoRails, LLC. All rights reserved.