Auto_complete and REST

Hi,

Just a quick survey on how ppl are dealing with auto complete fields
under
REST.

I’ve setup a controller PlaceController that I have an auto complete
field
for on state. The state should look up what’s been previously entered
in
the scope of country.

The old way,
/places/auto_complete_for_place_state?xxx

def auto_complete_for_place_state
@places = Place.find( :all, :conditions => [“name LIKE ? AND
country=?”,
“%#{params[:place][:name]}%”, params[:place][:country]] )
render :inline => “<%= auto_complete_result(@places, ‘state’) %>”
end

That works at the moment but I’m not convinced that it’s RESTFUL.

What if I used a url like

/places;state?xxxx

and then use a respond_to clause would this be considered more restful?

To me it doesn’t seem like it, but for the life of me I can’t think of a
way
to utilize
/places with some params in it to call my method for the auto complete
without resorting to nasty testing code in the controller.

How do you query one particular field of a resource restfully?

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