Topic: Very Basic API

Hello everyone

I'm adding the ability to update users data in our 2.3.11 rails app and have got it working but it kinda looks ugly and I'm not certain I'm going down the best/right track.

Is there a DRYer/better way of doing the following in my api controller?

  def update
    @userapi = User.find_by_username(params[:id])
    @userapi.firstname = params[:fs]

The system sending the POST is using this URL structure


Which works because of the following line in the routes.rb

map.connect ':controller/:id/:action'

The security, validation and error checking are still to be sorted out, so this is a kind of fore runner question :-)

Any help, tips, opinions, will be gratefully received.