rake routes

Posted: November 17, 2007 in Rails, Ruby on Rails, Technology

Mungkin mantra subjek posting blog kali ini rada basbang (basi banget) oh well. tapi sejujurnya baru tadi pagi (jam sembilanan gitu deh) ya saya ketemu pas coba main-mainan sama rails ini. :-D

aries-powerbook-g4-15:Desktop arie$ rails routes -d sqlite3
      create  
      create  app/controllers
[...]
      create  log/test.log
aries-powerbook-g4-15:Desktop arie$ cd routes
aries-powerbook-g4-15:routes arie$ script/about
About your application's environment
Ruby version                 1.8.6 (universal-darwin9.0)
RubyGems version             0.9.4
Rails version                1.2.5
Active Record version        1.15.5
Action Pack version          1.13.5
Action Web Service version   1.2.5
Action Mailer version        1.3.5
Active Support version       1.4.4
Application root             /Users/arie/Desktop/routes
Environment                  development
Database adapter             sqlite3

Jadi ini yang default nih segini (belum diapa-apain)

aries-powerbook-g4-15:routes arie$ rake routes
(in /Users/arie/Desktop/routes)
  /:controller/service.wsdl        {:action=>"wsdl"}
  /:controller/:action/:id.:format 
  /:controller/:action/:id         
aries-powerbook-g4-15:routes arie$ vi config/routes.rb

nah terus yang ini setelah diapa-apain, cuman ditambahin map.resources :products kok

aries-powerbook-g4-15:routes arie$ rake routes
(in /Users/arie/Desktop/routes)
              products GET    /products                  {:action=>"index", :controller=>"products"}
    formatted_products GET    /products.:format          {:action=>"index", :controller=>"products"}
                       POST   /products                  {:action=>"create", :controller=>"products"}
                       POST   /products.:format          {:action=>"create", :controller=>"products"}
           new_product GET    /products/new              {:action=>"new", :controller=>"products"}
 formatted_new_product GET    /products/new.:format      {:action=>"new", :controller=>"products"}
          edit_product GET    /products/:id/edit         {:action=>"edit", :controller=>"products"}
                       GET    /products/:id;edit         {:action=>"edit", :controller=>"products"}
                       GET    /products/:id.:format;edit {:action=>"edit", :controller=>"products"}
formatted_edit_product GET    /products/:id/edit.:format {:action=>"edit", :controller=>"products"}
               product GET    /products/:id              {:action=>"show", :controller=>"products"}
     formatted_product GET    /products/:id.:format      {:action=>"show", :controller=>"products"}
                       PUT    /products/:id              {:action=>"update", :controller=>"products"}
                       PUT    /products/:id.:format      {:action=>"update", :controller=>"products"}
                       DELETE /products/:id              {:action=>"destroy", :controller=>"products"}
                       DELETE /products/:id.:format      {:action=>"destroy", :controller=>"products"}
aries-powerbook-g4-15:routes arie$

contoh routing nggak advanced-advanced banget berhubung saya juga masi belajar banyak kok, itu juga ada film bagus banget lho dari railscast buat belajar-belajar restful rails di link ini (ciyaat ngiler langsung minta diklik linknya).

Jadi Met develop restful application dengan Ruby on Rails ;-) Nggak ngerasa jadi kek orang buta lagi kaan guessing guessing mulu duuh ini routes bakal jadi apa yah, atau duuuh ini kalo coding jorok gini bagusnya ini logic ditaroh di routes trus cara manggilnya gimana ya. lega….

tinggalkan feedback konstruktif atau lebih baik diam

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s