Related Link

Archive for the ‘Web Design’ Category

Ruby on Rails and PHP

Posted in Web Design

What’s the difference between them? Lets find out more about it. Which one is better? Ruby or PHP? The answer is relative, its all depends on the developer, which one they like the most. Among all website builder, all of them have their own strength and weakness.

Ruby has been designed from the ground up as an object oriented language, and has a well thought out syntax. While has a much more extensive library of extensions and modules, and it’s object oriented model has been implemented over time.
(more…)

Permalinks

Posted in Ruby on Rails, Web Design

A permalink is an attribute of a Story, so we’ll need to modify our schema so that one can be stored for each story. We’ve already seen migrations in action each of our existing migrations was generated when we created a new model. Now we need to expand an existing model, so that we can add a permalink attribute to the Story model.

To add a migration without adding a new model, we use the generate script, passing migration as the first parameter:
$ ruby script/generate migration AddPermalinkToStories
(more…)

URLs

Posted in Ruby on Rails, Web Design

In terms of viewing our sites, our users currently only have access to a page that displays a random story. To address this issue, we’ll add a new action that displays a single story, along with all of its details, before we implement the voting actions themselves. The story page will serve as a reference point for any given story on the site, as it will contain a range
of information voting actions, voting history, and so on about the story. Before we dive into the creation of our story page, let’s take a quick but important detour. The development of a story page such as this provides the perfect opportunity for a discussion about clean URLs.

Rails translates URLs of a certain format into actions that are invoked on a controller class. The translation, known as routing, is performed by the Rails Routing module.
Consider a URL that has the following format:

http://domain.com/story/show/1

(more…)

Creating a View

Posted in Ruby on Rails, Web Design

After creating a model and a controller, then its time for us to create a view. We can use two approaches to build views for our Rails application. One is to make use of scaffolding; the other is to “go it alone.” We’ll look at scaffolding very briefly, but we won’t be using it much in the development of our Shovell application. I’ll introduce just enough to give you a taste
of this topic, then leave it up to you to decide whether or not you find it worthwhile in your own projects.

Generating Views with Scaffolding
In the early days of Rails, scaffolding was one of the features that the Rails community used as a selling point when promoting the framework. Ironically, this feature also received a considerable amount of criticism, though this was
largely due to critics failing to understand fully the intended uses of scaffolding.
(more…)

Generating a controller

Posted in Ruby on Rails, Web Design

Now that we have our model in place (refer to previous article: Generating a model on Ruby), let’s build a controller. In the same way that we generated a model, we generate a controller by running the script/generate script from our application’s root folder.

Run the generate script from the command line again, but this time, pass controller as the first parameter:
$ ruby script/generate controller


(more…)

Favorite Link