Added by Tony Lancaster over 6 years ago
Is it possible to add a message to the boards via the command line / rake tasks? I’ve been looking at the v3 API and it looks as though that functionality isn’t yet implemented.
Looking at the sql, it appears 2 tables are involved in this, although I’d prefer to let the application sort this out.
Thanks.
Replies (5)
Hi Tony,
you’re right that boards are not yet contained in the APIv3 yet. To access it programatically, you don’t need a rake task to do that. You can execute a one-shot command with
rails runner
:Message.create!
will raise an error to STDERR if if cannot save your message. It also sets the exit code to 1.Best,
Oliver
Cheers for the reply, good to know it can be done this way.
After a little playing around with rvm to squish a couple of versioning errors, the command returns:
(erb):1:in `fetch’: Cannot load `Rails.application.database_configuration`: (KeyError)
key not found: “DATABASE_URL”
Any ideas?
It doesn’t find your database settings.
You may need to prefix this with your environment that you’re running on. For example
Best,
Oliver
That’s working now, much appreciated.
Can replies be added using something similar?