學習從頭開始創建 Rails 應用程序? (Learning to create a Rails application from scratch?)


問題描述

學習從頭開始創建 Rails 應用程序? (Learning to create a Rails application from scratch?)

I have done some work with Ruby on Rails but am still not comfortable writing a Rails app from scratch. My problem is that I am not able understand how to get the right model going when trying to write the application from scratch. I thought seeing the code of a complete existing application may help but am not sure. What should be the way to go for me?


參考解法

方法 1:

Get the book Agile Web Development with Rails.  It goes through an entire example.  It was really helpful for me when learning RoR.  Available as both PDF and hardcopy.

方法 2:

Apart from getting the book, watching the screencasts, reading the Rails Guides, you still need to actually make something of your own.

Accept this: you're going to make mistakes. That's OK, everybody else makes mistakes too. You're going to make the wrong models, create the wrong methods, the wrong tables with the wrong columns and that's OK too. You'll be doing the best you can and you'll get better. As your understanding - or Rails and of your application - improves so you'll see where you made mistakes and you'll fix them. (Or you'll give up!)

If you don't know what model to build first, try something like this: write a short description of your application as you currently understand it. Three or four sentences at most. Then look at your description and pick what seems to be the most important "thing". Try making that your first model.

So for a blog (sigh) application, you might write something like this (it doesn't have to be perfect, just write something):

"This app lets me write blog posts and publish them. Readers can post comments. I can remove comments I don't like".

The most important "object" there is probably "posts". So start with

ruby script/generate model Post

方法 3:

I second that book choice I would also recommend checking out these resources:

PeepCode Screencasts Peepcode is not free but Geoffrey has some really really great rails screencasts including a series targeted at getting started with rails that is well worth the investment.

Railscasts These are free screencasts on a wide range of rails specific topics which will are a great resource for when you want to learn how to do something specific in your app.

I'd also say that when you are learning rails you will only get so far before you need to focus on learning ruby too.  Rails takes advantage of some ruby features which may be unfamiliar to you if you are coming from another non-dynamic language.  So it's worth checking out some ruby learning resources this book is a great one for learning rails and ruby at the same time: Ruby for Rails by David Black

方法 4:

The best way to learn something is to practice it. Think of a good project (not necessarily a useful one, just something interesting) and then just make it. Don't sweat over the details. 

It doesn't matter if it doesn't work; Just throw it away and start again. With each new iteration/project you will learn and remember more.

方法 5:

start small, do something simple

a todo list a simple blog twitter clone (lol)

(by ArctvanfossonMike WoodhousepaulthenerdNathanedthix)

參考文件

  1. Learning to create a Rails application from scratch? (CC BY-SA 3.0/4.0)

#project-management #ruby-on-rails #ruby






相關問題

項目規劃,開發人員筆記工具 (Project planning, Note taking tool for developers)

你經歷過的最糟糕的項目失敗是什麼? (What is the worst project failure you've ever been on?)

用C構建項目的問題 (Problem with building project in C)

XCode 項目詳情? (XCode Project Details?)

您需要什麼技能來在Web Apps中進行正確的UI /交互/功能設計? (What skills do you need for proper UI/Interaction/Functional design in Web Apps?)

“變更管理”結束和“項目失敗”從哪裡開始? (Where does "Change Management" end and "Project Failure" begin?)

Subversion 存儲庫統計信息,不是 StatSVN? (Subversion repository statistics, other than StatSVN?)

對於企業 Web 應用程序,推薦的支持技術人員與開發人員的比例是多少? (What is a recommended support technician-to-developer ratio for an enterprise web application?)

將生產力提高到每人/天 1 個錯誤修正 (Improving productivity to 1 Bug correction per man/day)

學習從頭開始創建 Rails 應用程序? (Learning to create a Rails application from scratch?)

您使用項目日記或經驗數據庫嗎? (Do you use a project diary or experience database?)

誰應該編寫 dockerfile、SRE 或開發人員? (Who should write the dockerfile, SRE or developer?)







留言討論