views:

38

answers:

2

I want to write rails controller to allow user to update resource through json or xml like update status in twitter.


I tried to create some dummy controller like

def visit
...
end

and add route

map.connect 'users/visit', :controller => 'users', :action => 'visit', :conditions => {:method => :post}

but when I tired post some data with curl -d "var=1" http://localhost:3000/users/visit It's not work, after that I tried some basic user/create with curl -d "var=1 http://localhost:3000/users, but this not work either.Do I miss something ?

A: 

The default controller stub generated with the script/generator scaffold already provides support for XML requests. You just need to customize it.

This post might give you a better idea.

Simone Carletti
A: 

Take a look at John Nunemaker's Twitter RubyGem. It includes a status update example.

John Topley