cornelius wilson
2013-Jun-24 19:05 UTC
[HELP] Couldn''t find Search with id= from controller
I have been working on the search form for my app. The advanced search works fine, however I am unable to get the regular search form to work. It should be able to search the entire user database, and I should be able to string keywords together. For example if I search the term "no kids" it should return the results for everyone who has "no kids" listed on their profile. Then if I want to be more advance I can search "no kids, asian" and this would of course pull up users with Asian ethnicity that has no kids. When I do this I get the following error: Couldn''t find Search with id=kids. It points to the searches controller for the following line: def index @search = Search.find(params[:search]) Also a quick note I am following the railscast 111 for this. Attachments: http://www.ruby-forum.com/attachment/8535/searches_controller.rb http://www.ruby-forum.com/attachment/8536/user.rb http://www.ruby-forum.com/attachment/8537/search.rb -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/fa510b2ee367a0502b5a8c250b3298c2%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Tamara Temple
2013-Jun-25 09:33 UTC
Re: [HELP] Couldn''t find Search with id= from controller
cornelius wilson <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have been working on the search form for my app. The advanced search > works fine, however I am unable to get the regular search form to work. > It should be able to search the entire user database, and I should be > able to string keywords together. For example if I search the term "no > kids" it should return the results for everyone who has "no kids" listed > on their profile. Then if I want to be more advance I can search "no > kids, asian" and this would of course pull up users with Asian ethnicity > that has no kids. > > When I do this I get the following error: Couldn''t find Search with > id=kids. It points to the searches controller for the following line: > > def index > @search = Search.find(params[:search]) > > Also a quick note I am following the railscast 111 for this. > > Attachments: > http://www.ruby-forum.com/attachment/8535/searches_controller.rb > http://www.ruby-forum.com/attachment/8536/user.rb > http://www.ruby-forum.com/attachment/8537/search.rbWhat''s in the searches table? How are you populating it to do a Search.find? I''m a wee bit unclear why there''s a Search model at all, really... -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/51c963ec.e6a4320a.3064.721d%40mx.google.com. For more options, visit https://groups.google.com/groups/opt_out.
cornelius wilson
2013-Jun-25 14:22 UTC
Re: [HELP] Couldn''t find Search with id= from controller
I have it as a model to save all the searches to database. Originally I thought it would be good to have information on what users are searching for on a dating app, though I have back away from this in recent weeks. I just haven''t removed it as I don''t want to break the app. Searches table has gender, age, children, religion, ethnicity, created at, updated at. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/41d4e1de33bb54d8f195e6217ab04544%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
On 24 June 2013 20:05, cornelius wilson <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have been working on the search form for my app. The advanced search > works fine, however I am unable to get the regular search form to work. > It should be able to search the entire user database, and I should be > able to string keywords together. For example if I search the term "no > kids" it should return the results for everyone who has "no kids" listed > on their profile. Then if I want to be more advance I can search "no > kids, asian" and this would of course pull up users with Asian ethnicity > that has no kids. > > When I do this I get the following error: Couldn''t find Search with > id=kids. It points to the searches controller for the following line: > > def index > @search = Search.find(params[:search])find expects a numeric id value, presumable params[:search] is set to "kids" rather than an id. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsKPvhdjHG9xKm-FaTzBrDsr%2B0bX%3DRJiF7ErbT_cCi0Tw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
cornelius wilson
2013-Jun-26 15:01 UTC
Re: [HELP] Couldn''t find Search with id= from controller
Colin Law wrote in post #1113571:> On 24 June 2013 20:05, cornelius wilson <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> id=kids. It points to the searches controller for the following line: >> >> def index >> @search = Search.find(params[:search]) > > find expects a numeric id value, presumable params[:search] is set to > "kids" rather than an id. > > ColinHow would I be able to reverse it so that it searches for the term as oppose to the numeric id of the search options. As I would like for it to be able to search all things on a user profile. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d5b15638a0191f1f2b10ce875002db1c%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2013-Jun-26 19:27 UTC
Re: Re: [HELP] Couldn''t find Search with id= from controller
On 26 June 2013 16:01, cornelius wilson <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #1113571: >> On 24 June 2013 20:05, cornelius wilson <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> id=kids. It points to the searches controller for the following line: >>> >>> def index >>> @search = Search.find(params[:search]) >> >> find expects a numeric id value, presumable params[:search] is set to >> "kids" rather than an id. >> >> Colin > > How would I be able to reverse it so that it searches for the term as > oppose to the numeric id of the search options. As I would like for it > to be able to search all things on a user profile.I suggest you start by working right through a good tutorial such as railstutorial.org, which is free to use online. That will show you the basics of Rails. Also look through the Rails Guides, in particular the one on ActiveRecordQueryInterface. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLutodFJy0V44jhnVhN4Bct42h3VH4UaZ%3DShUhipNYS7vw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
cornelius wilson
2013-Jun-28 20:29 UTC
Re: Re: [HELP] Couldn''t find Search with id= from controller
Colin Law wrote in post #1113657:> On 26 June 2013 16:01, cornelius wilson <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> Colin >> >> How would I be able to reverse it so that it searches for the term as >> oppose to the numeric id of the search options. As I would like for it >> to be able to search all things on a user profile. > > I suggest you start by working right through a good tutorial such as > railstutorial.org, which is free to use online. That will show you > the basics of Rails. Also look through the Rails Guides, in > particular the one on ActiveRecordQueryInterface. > > ColinI did that tutorial months ago. I have been able to build inbox messaging from scratch, which was a challenging task with all the features a inbox must have especially considering I have no prior coding experience. I am 90% complete with my app, with the rest being small fixes such as this basic search form, having users select photo from gallery as their default profile picture, add user to favorites, and then the rest is javascript. Directing me to read a tutorial does not help me in this case. I have been stuck on this trying to figure it out. Had other people take a look and they too can not spot the problem. The error is coming from "@search = Search.find(params[:search])" in the searches controller for def index. I have tried different strings to see if I can get around it. None have work. One solution I thought would be best that just failed was moving the def index to the users controller and combining it with the " @users = User.all" that is already there. But that did not do anything either. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/44e3db3bf80f7dde640dbefcdffb5fc3%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2013-Jul-01 20:21 UTC
Re: Re: Re: [HELP] Couldn''t find Search with id= from controller
On 28 June 2013 21:29, cornelius wilson <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #1113657: >> On 26 June 2013 16:01, cornelius wilson <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>>> Colin >>> >>> How would I be able to reverse it so that it searches for the term as >>> oppose to the numeric id of the search options. As I would like for it >>> to be able to search all things on a user profile. >> >> I suggest you start by working right through a good tutorial such as >> railstutorial.org, which is free to use online. That will show you >> the basics of Rails. Also look through the Rails Guides, in >> particular the one on ActiveRecordQueryInterface. >> >> Colin > > I did that tutorial months ago. I have been able to build inbox > messaging from scratch, which was a challenging task with all the > features a inbox must have especially considering I have no prior coding > experience. I am 90% complete with my app, with the rest being small > fixes such as this basic search form, having users select photo from > gallery as their default profile picture, add user to favorites, and > then the rest is javascript. Directing me to read a tutorial does not > help me in this case. I have been stuck on this trying to figure it out. > Had other people take a look and they too can not spot the problem. > > The error is coming from "@search = Search.find(params[:search])" in the > searches controller for def index.Can you explain what that line of code is supposed to do? Colin> I have tried different strings to see > if I can get around it. None have work. One solution I thought would be > best that just failed was moving the def index to the users controller > and combining it with the " @users = User.all" that is already there. > But that did not do anything either. > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/44e3db3bf80f7dde640dbefcdffb5fc3%40ruby-forum.com. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLt%2Bc-UZW3nWxuY4d236R_Z6%2BtSWepO%2BVDGjdfvPtSB9jw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.