How to design and write my first blog using RoR?

I want to design a blog using RoR. It is also my initial step with RoR. I want to learn both Ruby and Rails with this real-life project that will be live on the net.

Since I am from a .NET background, I use a language of Toolbox with Controls on it. How to display blog posts one after the other as we see in blogs? Is there any Ruby control that is similar to .NET Repeater control?

Rails is too complicated. The typical way to learn rails is to copy an app out of a book, and you will have very little understanding of what is going on--especially if you don't know ruby at an intermediate level.

And if you need an app to copy… http://weblog.rubyonrails.org/2008/11/27/new-15-minute-blog-video-on-rails-2-2

It’s not the latest and greatest version, but it will get you started. Set your sights low initially, and plan to throw the first version away.

I have read few pages of Beginning Ruby by Peter Cooper. I can learn fast when I write a real-life project and implement techniques of the book and forums.

Here is a guide to create a blog:

http://guides.rubyonrails.org/getting_started.html

The development model is different than asp.net. There aren’t any controls. In case of the repeater, you iterate over the collection. Very rough sample code

Controller:

def index

@posts = Post.all

This fetches all posts and stores it in an instance variable named posts

end

in your view you iterate over this:

@posts.each do | post|

<%= post.message %>

This iterates over each element of posts and prints the message. Obviously you want do adorn this with the correct html elements.

And I agree that jump starting into a simple project is the best way of doing it. You will also want to look into rubygems.org

PS: The first week will be tough, but then you will see a sudden rise in productivity.

What are the initial steps? I have a little knowledge of PHP as well and with that limited knowledge I think first I need to design a web-page using HTML and CSS. Later I need to write Ruby classes and integrate code within those nasty HTML DIVs.

Is there any free Ruby front-end that can help? I have Aptana 3 installed. Anything better than that?

First you need to go through the tutorial I linked to.

Then you might want to add additional styling.

http://guides.rubyonrails.org/getting_started.html

is the best site for new ROR developer…

and it also show how to create simple blog …

Best of luck…

If you’re really interested in learning Rails and your first step is going to be writing HTML and CSS, you might be doing it wrong. Same thing with focusing on the editor you use.

Watch the flow in the Rails blog example video link (or the Rails guide that Martin linked to), and notice the flow of development. Then try writing your own code (borrowing heavily from these materials) to built your own app.

Rubyist Rohit wrote in post #1014409:

What are the initial steps? I have a little knowledge of PHP as well and with that limited knowledge I think first I need to design a web-page using HTML and CSS. Later I need to write Ruby classes and integrate code within those nasty HTML DIVs.

Guess what? After you figure out all the complexities of programming your site with rails, then you have to make it look good. CSS may be more complicated than rails.

@Martin:

I am going through the tutorial link you provided. It discusses about assumptions made by Ruby. One such assumption is: "Keeping code DRY (Don't Repeat Yourself)". Is Ruby assuming the drawbacks of code re-usability that is popular throughout programming paradigm?

Rubyist Rohit wrote in post #1014419:

@Martin:

I am going through the tutorial link you provided. It discusses about assumptions made by Ruby. One such assumption is: "Keeping code DRY (Don't Repeat Yourself)". Is Ruby assuming the drawbacks of code re-usability that is popular throughout programming paradigm?

Quite the opposite:

Situation 1: you have a method with 20 lines of code that performs a calculation, and every time you need to execute that code you call the method.

Situation 2: every time you need to do do the calculation, you write the 20 lines of code in your app.

Which situation would you deem to be the one that repeats itself?

7stud -- wrote in post #1014420:

Rubyist Rohit wrote in post #1014419:

Situation 1: you have a method with 20 lines of code that performs a calculation, and every time you need to execute that code you call the method.

Situation 2: every time you need to do do the calculation, you write the 20 lines of code in your app.

Which situation would you deem to be the one that repeats itself?

edit: Upon rereading your question, I have no idea what you are asking.

I mean, what is meant by DRY methodology of Ruby? If it insists to re-use code, then this paradigm is already there, from before Ruby.

What exactly is meant by: "Don't Repeat Yourself"?

From Wikipedia (which is the first Google result for “don’t repeat yourself”):

Isn't the concept of Classes mean this? Does Ruby has something more advanced?

Lots of people, especially beginners, copy and paste a lot of code. Just about everyone’s done it, and it’s a great way to get started and get something that works, but the resulting code can be brittle and hard to maintain because you’ve got the same or similar logic spread out everywhere. Classes and OO are tools, but they don’t insure against bad coding practices.

You’ll hear the term “refactoring” a lot. Look it up, and get to know what it means. It’s how you get from the kind of spaghetti I was describing to high-quality, DRY code.

IMO you are mixin Rails and Ruby. Rails has one focus on facilitating code reuse. In no way Ruby or Rails have invented code reuse. Nobody says that.

If you are learning Rails I think you should do what others are saying first.

Rubyist Rohit wrote in post #1014431: