TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How do you memorize the tons of commands related to rails?

8 点作者 aaronsung超过 10 年前
I am currently learning rails. I used to programming in .NET and Java ecosystem and I got good GUI tools/IDEs such as VS and Eclipse. However, when I had come into rails, I found there are tons of commands are needed to memorize before you can use rails efficiently, e.g. rvm commands related to gemsets, rails commands for generating controller and models, rake commands for managing databases, etc. I found it's a bit difficult for me. Do you guys have any tricks or tools for this hard job?

5 条评论

patio11超过 10 年前
Back 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.
评论 #9103926 未加载
rubiquity超过 10 年前
Realistically, you only need to memorize a few:<p>- rake test: run the entire test suite<p>- rails s: run the rails server<p>- rails c: opens up an IRB&#x2F;pry session with your Rails app<p>- rails g migration: create a new migration<p>- rake db:migrate - Run new migrations<p>- rake db:create - create the DB the first time<p>- rake db:schema:load - generate the DB from schema.rb<p>- rake db:setup - generate a new database from migrations<p>- rake routes - Spit out the routes and path helpers<p>Don&#x27;t ever use rails generate model&#x2F;controller. It generates so much garbage that you likely won&#x27;t need.<p>There are a bunch of other commands off of rake db:migrate but most aren&#x27;t needing to be memorized. Our brains are only so large and dense and mine is particularly small, memorize what is important and memorize how to look up the rest.
评论 #9098017 未加载
评论 #9095969 未加载
评论 #9097244 未加载
评论 #9096875 未加载
mechanical_fish超过 10 年前
Let me get the plug in first: if you are on a Mac, try Dash, the app that looks up docs for you. I have it mapped to a keystroke in emacs, and I can sometimes park the cursor atop, say, the word &#x27;render&#x27; and look it up in one motion.<p>(Sometimes it takes more motions, because Dash knows the docs for everything and sometimes doesn&#x27;t get the context right, but that might also be driver error: the app is always politely telling me that I could learn to use it even better.)<p>Docs aren&#x27;t always the best tool but it is good to have them at your fingertips.<p>patio11 is on to something when he suggests using your own codebases. Keep them all on your machine. Learn how to search them. (I use emacs and its various project-directory search utilities like Projectile and Helm, but there are other tools.)<p>If you don&#x27;t have any Rails codebases to refer to yet, Michael Hartl is here to help you.<p>Your personal library is best because it comes from your perspective and with your memory cues. It also only covers use cases you have actually seen, which sounds like a bug but which is actually a feature. The problem with trying to use public docs as references is that they cover all the features that you will never use.<p>One drawback of your personal library is that it will always feel obsolete. This is a good thing; it means you are improving. Fix it up in bits and pieces where you can. Borrow ideas from the pages you Google.<p>There is a school of thought which says that you should use your public Github profile as your personal library. Having dabbled in this for a while, I now reject it. Do not write your notes for an audience larger than one. The amount of time you spend thinking &quot;is it dangerous or embarrassing to record this line of code in my private personal repo?&quot; should be zero. If there is anything worse than having the internet read over your shoulder, it is <i>imagining</i> the internet reading over your shoulder. Buy a big private Github account, use Bitbucket, or run a private server for your hacks and notes.<p>Take notes on everything you do. In particular, get in the habit of pasting the command-line things that you do into a cheat sheet. This is the beginning of devops wisdom. One reason why the advanced deployer does everything with a script (or Vagrantfile, or Dockerfile) is that the script remembers the steps for you and can be looked up later.
barry-cotter超过 10 年前
Download anki or mnemnosyne or supermemo or any other Spaced Repetition System program. Add the 50 or so most common commands to it and what they do. If you set it to test you on 10 new commands a day you will know all of them cold within two weeks at five minutes a day.
heyalexej超过 10 年前
I use Anki[0] to learn and memorize tons of command line tools and Vim motions. It takes a couple minutes every day. Doing this in combination with actually using the tools brings fluency rather quickly.<p>[0] <a href="http://ankisrs.net" rel="nofollow">http:&#x2F;&#x2F;ankisrs.net</a>