Figured it out, the task should look like:
namespace :test do
task :new_task => :environment do
puts Parent.all.inspect
end
end
Notice the => :environment
dependency added to the task
More Related Contents:
- Rails ActiveRecord methods in different places [closed]
- accepts_nested_attributes_for with find_or_create?
- ActiveRecord.find(array_of_ids), preserving order
- When to use a “has_many :through” relation in Rails?
- Rails 5: ActiveRecord OR query
- Ruby on Rails. How do I use the Active Record .build method in a :belongs to relationship?
- ActiveRecord Find By Year, Day or Month on a Date field
- How to query a model based on attribute of another model which belongs to the first model?
- How to fix the uninitialized constant Rake::DSL problem on Heroku?
- How does Rails ActiveRecord chain “where” clauses without multiple queries?
- Rails: ActiveRecord query based on association value
- How to test for (ActiveRecord) object equality
- Rails 3, has_one / has_many with lambda condition
- What is the best way to seed a database in Rails?
- Bulk Insert records into Active Record table
- How to use ActiveRecord in a ruby script outside Rails?
- Regular expressions with validations in RoR 4
- Can’t migrate database after scaffold. Section 2.2 Ruby on Rails Tutorial Michael Hartl
- What are the brackets [5.1] after ActiveRecord Migration and how does it work? [duplicate]
- Rails – Validate Presence Of Association?
- Rails 3 migrations: Adding reference column?
- how to add records to has_many :through association in rails
- How to implement bulk insert in Rails 3
- How to show SQL queries run in the Rails console?
- Use bundle exec rake or just rake?
- Non persistent ActiveRecord model attributes
- Rails: Overriding ActiveRecord association method
- How do I avoid a race condition in my Rails app?
- How can I use ActiveRecord on a database that has a column named ‘valid’? (DangerousAttributeError)
- Specifying column name in a “references” migration