Showing posts with label rest. Show all posts
Showing posts with label rest. Show all posts

Wednesday, November 5, 2008

Rails Dynamic Links

Since I've been working on a program for Mindbridge for a while, (and you can see how busy I am), I try occasionally to post useful things I remember here. One is about Rails dynamic linking abilities. I recently forgot, then remembered again, about how easy it is to link to an object.

(%= link_to "View", @object %) instead of (%= link_to "View", object_path(@object) %)

You can use a handy REST cheat sheet to keep it all handy. It helps me remember that I have to explicitly declare the delete method, for example, in my links.

Monday, June 2, 2008

Scaffold versus Scaffold Resource

Scaffolding has always been the standard way to start a Ruby on Rails piece/component/controller, generating the standard files and paths based on the specified model name. More recently, though, scaffold now creates a RESTful version of these rails conventions. At one time it simply generated regular CRUD, and then scaffold_resource came along to create a REST-based controller, model, and views. Now scaffold does that, by creating the correct views, actions, and allowing Rails to respond to different types of requests (XML, HTML, etc), which make it more restful.