Forum: Ruby on Rails Live search in Rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8760848cc26a18d99910666c256613b5?d=identicon&s=25 Ste Hart (xcandyman)
on 2006-03-11 18:03
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_r...

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
7223c62b7310e164eb79c740188abbda?d=identicon&s=25 Xavier Noria (Guest)
on 2006-03-11 18:16
(Received via mailing list)
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_r...
>
> 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
8760848cc26a18d99910666c256613b5?d=identicon&s=25 Ste Hart (xcandyman)
on 2006-03-11 18:25
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
631d1677786f0725da6ccee46043686e?d=identicon&s=25 Jonathan Viney (Guest)
on 2006-03-12 12:08
(Received via mailing list)
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.
8760848cc26a18d99910666c256613b5?d=identicon&s=25 Ste Hart (xcandyman)
on 2006-03-12 12:56
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.
This topic is locked and can not be replied to.