Auto_complete and REST


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

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

The old way,

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

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

What if I used a url like


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
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