Alexander Castro in Seattle is doing 17 things including…

learn to program Rails


 

Alexander Castro has written 2 entries about this goal

Launched my first rails site! 3 years ago

Well, for the past three months I’ve been building my first real Rails application.

It’s a podcasting community site – http://www.pluggd.com. I can’t believe how far I’ve come in such a short period of time. Rails completely rocks. I’ve really learned a ton and have enjoyed using Rails. I’ve been fortunate to receive a good deal of help from other developers in the Rails community.

I can’t wait to continue to add interesting features to the site. My mind is full of ideas. Naturally, I’m always happy to hear ideas other folks might have.



Is Rails Schizo? 4 years ago

It has been a few weeks now since I started programming in Ruby and Rails. I really have it enjoyed it and I’m very impressed with Rails. However, I recently took some time to learn about the Ajax support in Rails and came away somewhat confused.

You see, Rails is a MVC (mode-view-controller) framework. However, the Ajax support in rails seems to encourage a developer to include view logic in their controller. Since one of the main benefits of Rails is the MVC framework, I was a bit confused by this.

Now, to be fair, my opinions here were formed after reading one article, Ajax on Rails by Curt Hibbs, and I’m still a Rails newbie.

Let me provide an example of what I found concerning. There form_remote_tag contains a paramter where you specify the ID of a DOM element that will be updated the action contain within the controller code.

For example,

form_remote_tag(:update => “my_list”, :url => { :action => :add_item }, :position => “top”)

This code snippet inidcates that add_item action is called in the controller when the form is submitted.

The controller code looks like this,

class ListdemoController < ApplicationController
  def add_item
    render_text "<li>"  params[:newitem]  "</li>"
  end
end

As you can see, HTML is generated from the controller. This means if you change the code in your view, you may need to go back and change the HTML generated by the controller so that is fits with the changes you made to your view. This is excatly the type of thing Rails avoids in so many other instances, and exactly why I’m so excited about Rails. What’s up with that!

I began to poke around the Ajax for Rails API documentation and found some reference to registering a client side javascript function that would be called. However, I wasn’t able to make this all work. I wasn’t able to find any good examples online and hope the new Rails book I ordered (Agile Web Development with Rails) will help.

In any event, I’m still very excited about Rails and hope this means there is still some opportunity for me to add to the community once I feel like I’m overcome the learning curve.



 

I want to:

The world wants to...

43 Things Login