Hello All,
I am new to Rails and am unable to figure out how to do multiple table
queries to a database using autocomplete
forms.
I have :
Author habtm Books through Works || Book has_many Chapters ||
Chapter has_many Sections
And a table unrelated to these directly called Keywords.
How can I create a page where I provide autocomplete boxes for each of
these so that a user can choose for a
particular keyword/s, author/s and book/s using Boolean logic? (one
view with multiple table search boxes)
ex: keyword ''civilization'' AND/OR/NOT author
''Jay'' AND/OR/NOT book
''xyz''
I was able to create multiple choice autocomplete boxes using the
following code:
<%=javascript_include_tag :defaults%>
<h4> Search for Authors </h4>
<% form_for :author, :url =>{:action => "show", :controller
=>
"author"} do |form|%>
<%= text_field_with_auto_complete :author, :name, {},{:tokens =>
['','', ''\n'']}%>
<%=submit_tag "Go", :id => @author%>
<%end%>
But once I added the tokens options, my show action does not work for
more than one choice (it works fine
when only one author was chosen).
My show.rhtml looks like this:
<% for column in Author.content_columns %>
<%= column.name %>:</b> <%=h @author.send(column.name) %>
<% end %>
Can someone please help me out?
Thanks,
KK
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---