Some questions of REST actions

I’ve set up my application to use edge rails in order to get REST
functionality.
I’ve a controller called team (team_controller.rb) with some actions
(index, list,
show, create, new…). Moreover in routes.rb I’ve added

map.resources :team

so I guess I could call

localhost:3000/xxxx/team/1

or

localhost:3000/xxxx/team/1;edit

Well, when I do the first call, server response me ‘Unknown action No
action responded to 1’, surprisingly the second call shows the edit form
for the team 1.

Isn’t it the first call supposed to invoke ‘show’ action and shows me
the team 1?

And if I do:

http://localhost:3000/team/1.xml

it shows me team 1 (not XML, but it shows me the html page)

On 8/11/06, Eduardo Yáñez Parareda [email protected] wrote:

[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

For your first question, you need to just do
localhost:3000/team/new
etc. Not sure what that xxxx is.

Also, to return XML, you need to use respond_to, i.e.

def show
@team = Team.find params[:id]
respond_to do |type|
type.html
type.xml { render :xml => @team.to_xml }
end
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs