In rails, when you create a rails project, by default (on the README) you will find a Rakefile.
I think that the Rake file refers to a file that personally executes some program such as badge processing, and rails g task ●● will generate a rake file under lib/tasks.
I don't understand the difference between the above two files. Basically, when you create a program that runs regularly, I think that this task is generated, but then I do not understand the significance of Rakefile. I understand that i am doing something for config/application.rb. . .
Answer # 1
Rakefile is a file that
rakecommand reads automatically.
Rails also uses rake to define development tasks, so the first code loaded is
However, since the Rakefile generated by Rails contains code that calls the process of reading the rake file under the lib/tasks directory from the beginning, the task definition file placed in lib/tasks/Seems to be loaded without the programmer doing anything.
rakecommand reads files by default
Files read by Rails conventionsI think it is a difference of
You should write tasks in the latter while using Rails, and in the former when using outside Rails.
By the way
I think that a Rake file is a file that personally executes some program such as badge processing
Rake itself is one of Ruby's standard libraries, just a kind of task runner.Since it is
It just exists to run Ruby processing in order considering dependencies.
, it is very convenient to use it for Batch processing etc., but it is not dedicated to it.
Rails is also used to provide auxiliary commands.
- ruby on rails 5 - i don't understand the difference between signup_path and new_user_path
- ruby on rails 5 - i can't understand the difference between helper and partial
- difference between executing puts in ruby method and executing puts when executing method
- [ruby on rails] relationship between transaction and pessimistic lock/optimistic lock
- mysql - rails api: difference between @userarticles and articlewhere('user_id' == 1)
- ruby on rails - i want to change the size of the carrierwave default image
- ruby on rails - i want to api communication between containers created with docker-compose
- ruby on rails - correlation between web application development and smartphone application development
- ruby - what is the difference between session and save?
- ruby - what to do with the rails group task management app db association
- ruby on rails - i want to display the contents of the database
- ruby on rails - how to link multiple rails apps with docker-compose?
- ruby on rails - how to change the appearance and tags dynamically with rails
- ruby on rails - resolve nomethoderror
- ruby - [rails] when registering new data in form_with, nomethoderror appears and the process fails
- ruby on rails 5 - an error occurs if there is a form in form_with
- ruby - i want to create a rails purchase id
- ruby on rails - devise login screen
- ruby on rails - login page root (devise)
- ruby - about classes and modules in rails
- ruby - when editing the initial value of text_field
- ruby - i don't know how to put data scraped by nokogiri into sqlite3 database
- ruby - i want to display the chart of chartkick in index for each record of the table
- ruby - how to pass data from rails 6 model to vuejs
- ruby - [rails] i want to get the latest multiple data from the database
- ruby - rails db:create cannot be done rails + postgresql environment construction
- ruby - i get an argumenterror
- you can do redirect_to with ruby on rails, but you get nomethoderror when rendering