Realistically, you only need to memorize a few: - rake test: run the entire test suite - rails s: run the rails server - rails c: opens up an IRB/pry session with your Rails app - rails g migration: create a new migration - rake db:migrate - Run new migrations - rake db:create - create the DB the first time - rake db:schema:load - generate the DB from schema.rb - rake db:setup - generate a new database from migration…
'rake' also runs the entire test suite, as it's an alias for 'rake test'. I really disagree on the bit about not using rails g for controllers, and especially models. If you include your fields and types in the generate command you are given the corresponding migration, fixture, and test file for said model. If most of what you need can be generated by a single command, that's a whole lot less to remember compared to…
Ask HN: How do you memorize the tons of commands related to rails?
11–14 of 14 posts
Re: Ask HN: How do you memorize the tons of commands related to rails?
#12Back in the day, I had Amy Hoy's Rails cheatsheet printed out next to my work desk, and I referred to it pretty constantly for the first few weeks. ~6 years later all of the common stuff is second-nature and the esoteric stuff is either a) somewhere in one of my codebases or b) on Google.
https://www.addedbytes.com/cheat-sheets/ruby-on-rails-cheat-...
Re: Ask HN: How do you memorize the tons of commands related to rails?
#13Earlier quoted context omitted.
'rake' also runs the entire test suite, as it's an alias for 'rake test'. I really disagree on the bit about not using rails g for controllers, and especially models. If you include your fields and types in the generate command you are given the corresponding migration, fixture, and test file for said model. If most of what you need can be generated by a single command, that's a whole lot less to remember compared to…
I think I made the decision a couple years ago that I'd rather just remember what the files should look like and create them as I need them. I work on varying types of Rails apps (some full-on HTML/JS and others just JSON APIs) where a lot of times you don't need most of those files. I could see merit in just remembering the generator commands, though.
Re: Ask HN: How do you memorize the tons of commands related to rails?
#14Earlier quoted context omitted.
I think I made the decision a couple years ago that I'd rather just remember what the files should look like and create them as I need them. I work on varying types of Rails apps (some full-on HTML/JS and others just JSON APIs) where a lot of times you don't need most of those files. I could see merit in just remembering the generator commands, though.
I see. I'm on the same boat as far as developing varying types of apps w/ Rails. Disabling things I don't need, like asset pipeline for API dev is pretty quick: config.assets.enabled and config.generators.assets set to false and you don't have to worry about generators creating any unnecessary js/css in that scenario. Out of curiosity, what other things are being generated that wouldn't be of use?
Good call on just removing the generators though. I should just do that.