It's still returning all users. I think the issue is that TS is trying to
pull from http://localhost:3000/users/_user.html.erb which there is no
route for that. It should be pulling from /users as that is the page with
the list of usernames and then that way TS can go inside and search each of
those profiles. But I am not sure at how to exactly stop it from going into
_user.html.
Development log:
Started GET "/searches?utf8=%E2%9C%93&search=asian" for 127.0.0.1 at
> 2013-08-13 11:25:15 -0400
> Processing by SearchesController#index as HTML
> Parameters: {"utf8"=>"✓", "search"=>"asian"}
> [1m [35mUser Load (0.5ms) [0m SELECT `users`.* FROM `users`
> Rendered users/_user.html.erb (2.2ms)
> Rendered searches/index.html.erb within layouts/application (6.5ms)
> [1m [36mUser Load (0.5ms) [0m [1mSELECT `users`.* FROM `users` WHERE
> `users`.`auth_token` = 'LTzif2q6921TM4pQzfmEGg' LIMIT 1 [0m
> Completed 200 OK in 19ms (Views: 17.6ms | ActiveRecord: 1.0ms)
On Friday, August 9, 2013 9:12:51 PM UTC-4, Pat Allan wrote:
>
> Try <%= render @users.to_a %> instead - Rails helper magic may be
> expecting an actual Array class.
>
> On 10/08/2013, at 2:43 AM, C Wilson wrote:
>
> > Oh ok. Glad I'm on the right page then as I was starting to freak out
> lol.
> >
> > So the issue must be in my view. Are their unique attributes for TS in
> the view?
> >
> > All I have on the index view is <%= render @users %>. As I use that for
> my advanced search form.
> >
> > On Friday, August 9, 2013 10:55:53 AM UTC-4, Pat Allan wrote:
> > What you're seeing in the console is actually correct - Thinking Sphinx
> lazily loads results (like ActiveRecord) so what you're seeing is normal.
> If you try to access the first result, or iterate through them, or anything
> else where the actual contents is required, it'll make the call to Sphinx
> and return the appropriate User objects.
> >
> > To see actual results in your console, add .to_a onto the search
> results. And what you've got in your index action looks correct.
> >
> > Cheers
> >
> > --
> > Pat
> >
> > On 10/08/2013, at 12:39 AM, C Wilson wrote:
> >
> > > I'm a little confused at how to setup in controller to pull the search
> results. For def index I have:
> > >
> > > @users = params[:query].blank? ? User.all :
> User.search(params[:query])
> > >
> > > And that in return pulls all users when performing a search. But I
> have a dating app so I need it to only pull users that has the data that
> was search for.
> > >
> > > Even if trying it in console with User.search 'asian' or any other
> option I get:
> > >
> > > <ThinkingSphinx::Masks::PaginationMask:0x007fe011785ca0
> @search=#<ThinkingSphinx::Masks::PaginationMask:0x007fe011785ca0 ...>>
> > >
> > > So I know it's not setup right. Do I need to list conditions for all
> searches beneath @users? I'm new to rails so this isn't coming to me as
> good as others. And there's really no examples at how to setup in
> controller.
> > >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups "Thinking Sphinx" group.
> > > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> > > To post to this group, send email to [email protected].
> > > Visit this group at http://groups.google.com/group/thinking-sphinx.
> > > For more options, visit https://groups.google.com/groups/opt_out.
> > >
> > >
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Thinking Sphinx" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected] <javascript:>.
> > To post to this group, send email to
> > [email protected]<javascript:>.
>
> > Visit this group at http://groups.google.com/group/thinking-sphinx.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
>
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.