Hi i''ve been trying to implement live search on rails but Im having
trouble Im using a tutorial at:
http://www.joestelmach.com/blog/live_search_with_ruby_on_rails
But im getting a syntaxerror on line 1
''1: <% if @items && @items.length > 0% >''
I cant fathom what im doing wrong, is that line calling a column in
my database called items?
Here''s the error
./script/../config/../app/views/domain/search.rhtml:1: syntax error
./script/../config/../app/views/domain/search.rhtml:3: syntax error
<% for domain in @items ; _erbout.concat "\n"
^
./script/../config/../app/views/domain/search.rhtml:3: syntax error
<% for domain in @items ; _erbout.concat "\n"
^
./script/../config/../app/views/domain/search.rhtml:6: syntax error
./script/../config/../app/views/domain/search.rhtml:7: syntax error
./script/../config/../app/views/domain/search.rhtml:8: syntax error
:action => "show", :id => domain.id ).to_s);
_erbout.concat "\n"
^
./script/../config/../app/views/domain/search.rhtml:12: syntax error
elsif @mark_term && @mark_term.length > 0 ; _erbout.concat
"\n"
^
Thanks
--
Posted via http://www.ruby-forum.com/.
On Mar 11, 2006, at 18:03, Ste Hart wrote:> Hi i''ve been trying to implement live search on rails but Im having > trouble Im using a tutorial at: > > http://www.joestelmach.com/blog/live_search_with_ruby_on_rails > > But im getting a syntaxerror on line 1 > > ''1: <% if @items && @items.length > 0% >''There''s an invalid space between "%" and ">": <% if @items && @items.length > 0 %> -- fxn
Thanks that helped but got another error
compile error
./script/../config/../app/views/find/search.rhtml:6: syntax error
./script/../config/../app/views/find/search.rhtml:7: syntax error
./script/../config/../app/views/find/search.rhtml:8: syntax error
:action => "show", :id => domain.id ).to_s);
_erbout.concat "\n"
^
Extracted source (around line #6):
3: <% for domain in @items %>
4: <li>
5: <%= link_to
6: @mark_term ? highlight(domain.id, @mark_term) : h(domain.id),
7: :controller => "domain",
8: :action => "show", :id => domain.id %>
9: </li>
steve
--
Posted via http://www.ruby-forum.com/.
You probably need the first argument to link_to on the same line as the
method call:
<%= link_to @mark_term ? highlight(domain.id, @mark_term) : h(domain.id),
:controller => "domain",
:action => "show", :id => domain.id %>
-Jonathan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060312/46389c42/attachment.html
Hi Jonathan, I''ve worked out what was wrong it was calling an action ''show'' that didnt exist. Thanks Steve Jonathan Viney wrote:> You probably need the first argument to link_to on the same line as the > method call: > > <%= link_to @mark_term ? highlight(domain.id, @mark_term) : > h(domain.id), > :controller => "domain", > :action => "show", :id => domain.id %> > > > -Jonathan.-- Posted via http://www.ruby-forum.com/.