Hi all,

I'd like to update an attribute in a model via an external POST request.
The external request is coming from an iOS iPhone application but I
imagine this is not relevant.

If I have a model App and it has the following attributes...

App
  apple_identifier  :integer
  popularity :integer

I imagine I need an update reference in routes.rb like this..

  map.resources :apps, :only => [:index, :show, :update]

I then have the following in routes

     PUT /apps/:id(.:format) {:action=>"update", :controller=>"apps"}

So what might the apps_controller update action look like to receive the
request and update the popularity count by one...I pretty much think I
can solve that myself really I just want to know my thinking it on the
right lines.

One thing, rake routes says PUT - is that the same as post?

What would the URL look like that I ask my iOS dev for, is it as simple
as what follows - any gotchas?

I imagine...(POST to...) http://server.com/apps/456

def update
 find App record 456 and update it's popularity count
end

Is it really that simple ?

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to