Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
Autocomplete and belongs_to associations
5 Posts
Autocomplete and belongs_to associations

Hi, I need some help with autocomplete module in rails 2.0.2

My app has a "product" model with "name" and "price" attributes.

There is a "purchase_order" model that is related to product through "belongs_to" and has an attribute called "amount"

I can write the product_id or the product_name in the form field and the purchase_order is created.

What I want is to show a list of products while you are writing the name so you can choose one from the list instead of writing the full product name.

I can't find the solution out there (even GoogleGod fails sometimes)

Thanks in advance

Hola Francisco!

Me alegro mucho ver un español tirando a los Rails!! Que bien!

En cuanto a tu pregunta... bueno, mejor en íngles como hay más gente aquí también!

In regards to your question Francisco, check out http://demo.script.aculo.us/ajax/autocompleter their example is straight forward and probably one of the most widely used examples for AJAX autocompletion.

Hope that helps, Suerte amigo, Mateo

I was having the same problem and finding no solution. I finally found the model_auto_completer plugin and it works great. script/plugin install svn://rubyforge.org/var/svn/model-ac/trunk/vendor/plugins/model_auto_completer

I hope this helps

Thanks Matthew and Jason

I didn't understand well de autocompleter documentation so I used the model_auto_completer plugin and it's working fine.

Now I want to try something similar with "has_many :through" relationships... Well, I'll ask you again if I can't find a good solution.

Thanks again.

hello u can see this, this may solve ur problem autocompleter-example-in-ruby-on-rails

5 Posts
Login to add your message