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?
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---