Thursday, March 25, 2010

Tips: Rails 3 Rake Routes Task

Seperti yang kita tahu, perintah rake routes berguna untuk mengetahui route apa saja yang tersedia pada aplikasi Rails kita. Pada Rails 3, kita dapat mengetahui route apa saja yang tersedia pada controller tertentu. Contoh:
[email protected]:~$rake routes CONTROLLER=users
(in /home/aji/lab/my_app)
          GET    /users(.:format)          {:controller=>"users", :action=>"index"}
    users POST   /users(.:format)          {:controller=>"users", :action=>"create"}
 new_user GET    /users/new(.:format)      {:controller=>"users", :action=>"new"}
          GET    /users/:id(.:format)      {:controller=>"users", :action=>"show"}
          PUT    /users/:id(.:format)      {:controller=>"users", :action=>"update"}
     user DELETE /users/:id(.:format)      {:controller=>"users", :action=>"destroy"}
edit_user GET    /users/:id/edit(.:format) {:controller=>"users", :action=>"edit"



No comments:

Post a Comment

© Railsmine