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?
我已经使用Ruby on Rails做了一些工作但是仍然不习惯从头开始编写Rails应用程序。我的问题是,当我尝试从头开始编写应用程序时,我无法理解如何使正确的模型运行。我认为看到一个完整的现有应用程序的代码可能会有所帮助,但我不确定。应该怎样对待我?
7 个解决方案
#1
4
Apart from getting the book, watching the screencasts, reading the Rails Guides, you still need to actually make something of your own.
除了获取书籍,观看截屏视频,阅读Rails指南外,您还需要实际制作自己的东西。
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!)
接受这个:你会犯错误。没关系,其他人也犯错误。你要制作错误的模型,创建错误的方法,错误的表格,错误的列,这也没关系。你将尽你所能,你会变得更好。随着您的理解 - 或者Rails和您的应用程序 - 得到改进,您将看到您犯错误的地方并且您将修复它们。 (或者你会放弃!)
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
#2
9
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.
获取使用Rails的Agile Web Development一书。它通过一个完整的例子。在学习RoR时,这对我很有帮助。可用作PDF和硬拷贝。
#3
2
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.
PeepCode Screencasts Peepcode不是免费的,但Geoffrey有一些真正非常棒的视频截屏,包括一系列旨在开始使用rails的非常值得的投资。
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.
Railscasts这些是针对各种特定主题的免费截屏视频,当您想要学习如何在应用中执行特定操作时,这将是一个很好的资源。
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
我还会说,当你学习rails时,你只需要专注于学习ruby。如果你来自另一种非动态语言,Rails会利用一些你可能不熟悉的ruby功能。所以值得查看一些ruby学习资源这本书是同时学习rails和ruby的好书:David Black的Ruby for Rails
#4
1
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
0
start small, do something simple
从小做起,做一些简单的事
a todo list a simple blog twitter clone (lol)
todo列出一个简单的博客推特克隆(笑)
#6
0
I'd say agile web development with rails is the best call. The version 3 got released recently
我想说使用rails进行敏捷的Web开发是最好的选择。版本3最近发布
Then try creating a simple application and don't be afraid to restart from scratch a couple of time if you find a better way to design your application
然后尝试创建一个简单的应用程序,如果您找到更好的方法来设计应用程序,请不要害怕从头开始重新启动几次
#7
0
There is an excellent free online tutorial to Restful Rails applications @ http://www.b-simple.de/documents Moreover, its in english, german & spanish, at the same price!
有一个优秀的免费在线教程Restful Rails应用程序@ http://www.b-simple.de/documents此外,它的英语,德语和西班牙语,同样的价格!
It is clear & effective. It has a few mistakes, but nothing blocking...
它清晰有效。它有一些错误,但没有任何障碍......
#1
4
Apart from getting the book, watching the screencasts, reading the Rails Guides, you still need to actually make something of your own.
除了获取书籍,观看截屏视频,阅读Rails指南外,您还需要实际制作自己的东西。
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!)
接受这个:你会犯错误。没关系,其他人也犯错误。你要制作错误的模型,创建错误的方法,错误的表格,错误的列,这也没关系。你将尽你所能,你会变得更好。随着您的理解 - 或者Rails和您的应用程序 - 得到改进,您将看到您犯错误的地方并且您将修复它们。 (或者你会放弃!)
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
#2
9
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.
获取使用Rails的Agile Web Development一书。它通过一个完整的例子。在学习RoR时,这对我很有帮助。可用作PDF和硬拷贝。
#3
2
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.
PeepCode Screencasts Peepcode不是免费的,但Geoffrey有一些真正非常棒的视频截屏,包括一系列旨在开始使用rails的非常值得的投资。
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.
Railscasts这些是针对各种特定主题的免费截屏视频,当您想要学习如何在应用中执行特定操作时,这将是一个很好的资源。
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
我还会说,当你学习rails时,你只需要专注于学习ruby。如果你来自另一种非动态语言,Rails会利用一些你可能不熟悉的ruby功能。所以值得查看一些ruby学习资源这本书是同时学习rails和ruby的好书:David Black的Ruby for Rails
#4
1
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
0
start small, do something simple
从小做起,做一些简单的事
a todo list a simple blog twitter clone (lol)
todo列出一个简单的博客推特克隆(笑)
#6
0
I'd say agile web development with rails is the best call. The version 3 got released recently
我想说使用rails进行敏捷的Web开发是最好的选择。版本3最近发布
Then try creating a simple application and don't be afraid to restart from scratch a couple of time if you find a better way to design your application
然后尝试创建一个简单的应用程序,如果您找到更好的方法来设计应用程序,请不要害怕从头开始重新启动几次
#7
0
There is an excellent free online tutorial to Restful Rails applications @ http://www.b-simple.de/documents Moreover, its in english, german & spanish, at the same price!
有一个优秀的免费在线教程Restful Rails应用程序@ http://www.b-simple.de/documents此外,它的英语,德语和西班牙语,同样的价格!
It is clear & effective. It has a few mistakes, but nothing blocking...
它清晰有效。它有一些错误,但没有任何障碍......