Im in love with meta_search, a great gem but i have a question: when using it in controllers wich has the same name as the model (Photo => PhotosController) it workes like a charm. But i have a PeoplesController for handling accounts, profiles etc - and if i try to use it there i get an error of: NoMethodError in Peoples#index Showing /index.html.erb where line #33 raised: undefined method `screen_name_contains'' for #<ActiveRecord::Relation: 0x10676f2a8> Controller: def index @search = Account.search(params[:search]) @users = @search.where(:status => "active").page(params[:page]).per(24) end Any advice ? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, May 24, 2011 at 9:35 AM, Niklas Nson <niklasnson-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> wrote:> Im in love with meta_search, a great gem but i have a question: when > using it in controllers wich has the same name as the model (Photo => > PhotosController) it workes like a charm. But i have a > PeoplesController for handling accounts, profiles etc - and if i try > to use it there i get an error of: > > NoMethodError in Peoples#index > Showing /index.html.erb where line #33 raised: > undefined method `screen_name_contains'' for #<ActiveRecord::Relation: > 0x10676f2a8> >I think you need to put the model name --- so something like: photo_user_screen_name Where you are telling metasearch in a similar way that you would to AR about the association to your current model, then the associated models field.> > Controller: > > def index > @search = Account.search(params[:search]) > @users = @search.where(:status => > "active").page(params[:page]).per(24) > end > > Any advice ? > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks for your reply - sadly i cant get it working. :routes => match "/peoples" => "peoples#index", :as => "peoples" Both accounts_ and _account results in undefined method `account(s)_screen_name_contains'' for #<ActiveRecord::Relation:0x106ae3da8> Can i set up the relation in the controller ? On 24 Maj, 17:05, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:> On Tue, May 24, 2011 at 9:35 AM, Niklas Nson <niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> wrote: > > Im in love with meta_search, a great gem but i have a question: when > > using it in controllers wich has the same name as the model (Photo => > > PhotosController) it workes like a charm. But i have a > > PeoplesController for handling accounts, profiles etc - and if i try > > to use it there i get an error of: > > > NoMethodError in Peoples#index > > Showing /index.html.erb where line #33 raised: > > undefined method `screen_name_contains'' for #<ActiveRecord::Relation: > > 0x10676f2a8> > > I think you need to put the model name --- so something like: > > photo_user_screen_name > > Where you are telling metasearch in a similar way that you would to AR about > the association to your current model, then the associated models field. > > > > > > > Controller: > > > def index > > @search = Account.search(params[:search]) > > @users = @search.where(:status => > > "active").page(params[:page]).per(24) > > end > > > Any advice ? > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, May 24, 2011 at 10:54 AM, Niklas Nson <niklasnson-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org>wrote:> Thanks for your reply - sadly i cant get it working. > > :routes => > match "/peoples" => "peoples#index", :as => "peoples" > > Both accounts_ and _account results in > undefined method `account(s)_screen_name_contains'' for > #<ActiveRecord::Relation:0x106ae3da8> > > Can i set up the relation in the controller ? >Should not be a problem. First, have you seen the section ''Multi-level associations'' on https://github.com/ernie/meta_search ? If you still have trouble, probably easiest is post your current meta search code and the models you are trying to associate, and their associated schema (fields).> > On 24 Maj, 17:05, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > On Tue, May 24, 2011 at 9:35 AM, Niklas Nson <niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> > wrote: > > > Im in love with meta_search, a great gem but i have a question: when > > > using it in controllers wich has the same name as the model (Photo => > > > PhotosController) it workes like a charm. But i have a > > > PeoplesController for handling accounts, profiles etc - and if i try > > > to use it there i get an error of: > > > > > NoMethodError in Peoples#index > > > Showing /index.html.erb where line #33 raised: > > > undefined method `screen_name_contains'' for #<ActiveRecord::Relation: > > > 0x10676f2a8> > > > > I think you need to put the model name --- so something like: > > > > photo_user_screen_name > > > > Where you are telling metasearch in a similar way that you would to AR > about > > the association to your current model, then the associated models field. > > > > > > > > > > > > > Controller: > > > > > def index > > > @search = Account.search(params[:search]) > > > @users = @search.where(:status => > > > "active").page(params[:page]).per(24) > > > end > > > > > Any advice ? > > > > > -- > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > For more options, visit this group at > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I think i have mislead you with the subject line of this post. Its not that Peoples are a releation of Accounts. Peoples are just a Controller to move the viewing parts account from AccountController. So the problem is not how to do a relation between two models; i need to get meta_search understand that it should search the Account (and then models associated to Account). I think i get the error because it cant find any model to search (which is correct; people doesn''t exists. /Niklas On 24 Maj, 18:51, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:> On Tue, May 24, 2011 at 10:54 AM, Niklas Nson <niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org>wrote: > > > Thanks for your reply - sadly i cant get it working. > > > :routes => > > match "/peoples" => "peoples#index", :as => "peoples" > > > Both accounts_ and _account results in > > undefined method `account(s)_screen_name_contains'' for > > #<ActiveRecord::Relation:0x106ae3da8> > > > Can i set up the relation in the controller ? > > Should not be a problem. First, have you seen the section ''Multi-level > associations'' onhttps://github.com/ernie/meta_search? > > If you still have trouble, probably easiest is post your current meta search > code and the models you are trying to associate, and their associated schema > (fields). > > > > > > > On 24 Maj, 17:05, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > > On Tue, May 24, 2011 at 9:35 AM, Niklas Nson <niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> > > wrote: > > > > Im in love with meta_search, a great gem but i have a question: when > > > > using it in controllers wich has the same name as the model (Photo => > > > > PhotosController) it workes like a charm. But i have a > > > > PeoplesController for handling accounts, profiles etc - and if i try > > > > to use it there i get an error of: > > > > > NoMethodError in Peoples#index > > > > Showing /index.html.erb where line #33 raised: > > > > undefined method `screen_name_contains'' for #<ActiveRecord::Relation: > > > > 0x10676f2a8> > > > > I think you need to put the model name --- so something like: > > > > photo_user_screen_name > > > > Where you are telling metasearch in a similar way that you would to AR > > about > > > the association to your current model, then the associated models field. > > > > > Controller: > > > > > def index > > > > @search = Account.search(params[:search]) > > > > @users = @search.where(:status => > > > > "active").page(params[:page]).per(24) > > > > end > > > > > Any advice ? > > > > > -- > > > > 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@googlegroups.com > > . > > > > To unsubscribe from this group, send email to > > > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > For more options, visit this group at > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, May 24, 2011 at 1:14 PM, Niklas Nson <niklasnson-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> wrote:> I think i have mislead you with the subject line of this post. > Its not that Peoples are a releation of Accounts. Peoples are just a > Controller > to move the viewing parts account from AccountController. So the > problem is not how to do a > relation between two models; i need to get meta_search understand that > it should search the > Account (and then models associated to Account). I think i get the > error because it cant find > any model to search (which is correct; people doesn''t exists. > >Right... metasearch is pretty magical but does not have psychic abilities :)> > /Niklas > > On 24 Maj, 18:51, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > On Tue, May 24, 2011 at 10:54 AM, Niklas Nson <niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org > >wrote: > > > > > Thanks for your reply - sadly i cant get it working. > > > > > :routes => > > > match "/peoples" => "peoples#index", :as => "peoples" > > > > > Both accounts_ and _account results in > > > undefined method `account(s)_screen_name_contains'' for > > > #<ActiveRecord::Relation:0x106ae3da8> > > > > > Can i set up the relation in the controller ? > > > > Should not be a problem. First, have you seen the section ''Multi-level > > associations'' onhttps://github.com/ernie/meta_search? > > > > If you still have trouble, probably easiest is post your current meta > search > > code and the models you are trying to associate, and their associated > schema > > (fields). > > > > > > > > > > > > > On 24 Maj, 17:05, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > > > On Tue, May 24, 2011 at 9:35 AM, Niklas Nson <niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org > > > > > wrote: > > > > > Im in love with meta_search, a great gem but i have a question: > when > > > > > using it in controllers wich has the same name as the model (Photo > => > > > > > PhotosController) it workes like a charm. But i have a > > > > > PeoplesController for handling accounts, profiles etc - and if i > try > > > > > to use it there i get an error of: > > > > > > > NoMethodError in Peoples#index > > > > > Showing /index.html.erb where line #33 raised: > > > > > undefined method `screen_name_contains'' for > #<ActiveRecord::Relation: > > > > > 0x10676f2a8> > > > > > > I think you need to put the model name --- so something like: > > > > > > photo_user_screen_name > > > > > > Where you are telling metasearch in a similar way that you would to > AR > > > about > > > > the association to your current model, then the associated models > field. > > > > > > > Controller: > > > > > > > def index > > > > > @search = Account.search(params[:search]) > > > > > @users = @search.where(:status => > > > > > "active").page(params[:page]).per(24) > > > > > end > > > > > > > Any advice ? > > > > > > > -- > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > -- > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > For more options, visit this group at > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
And no way of letting the PeopleController letting it know that it should user Accounts ? /Niklas. On 24 Maj, 20:30, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:> On Tue, May 24, 2011 at 1:14 PM, Niklas Nson <niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> wrote: > > I think i have mislead you with the subject line of this post. > > Its not that Peoples are a releation of Accounts. Peoples are just a > > Controller > > to move the viewing parts account from AccountController. So the > > problem is not how to do a > > relation between two models; i need to get meta_search understand that > > it should search the > > Account (and then models associated to Account). I think i get the > > error because it cant find > > any model to search (which is correct; people doesn''t exists. > > Right... metasearch is pretty magical but does not have psychic abilities :) > > > > > > > /Niklas > > > On 24 Maj, 18:51, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > > On Tue, May 24, 2011 at 10:54 AM, Niklas Nson <niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org > > >wrote: > > > > > Thanks for your reply - sadly i cant get it working. > > > > > :routes => > > > > match "/peoples" => "peoples#index", :as => "peoples" > > > > > Both accounts_ and _account results in > > > > undefined method `account(s)_screen_name_contains'' for > > > > #<ActiveRecord::Relation:0x106ae3da8> > > > > > Can i set up the relation in the controller ? > > > > Should not be a problem. First, have you seen the section ''Multi-level > > > associations'' onhttps://github.com/ernie/meta_search? > > > > If you still have trouble, probably easiest is post your current meta > > search > > > code and the models you are trying to associate, and their associated > > schema > > > (fields). > > > > > On 24 Maj, 17:05, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > > > > On Tue, May 24, 2011 at 9:35 AM, Niklas Nson <niklasn...@meantime.se > > > > > wrote: > > > > > > Im in love with meta_search, a great gem but i have a question: > > when > > > > > > using it in controllers wich has the same name as the model (Photo > > => > > > > > > PhotosController) it workes like a charm. But i have a > > > > > > PeoplesController for handling accounts, profiles etc - and if i > > try > > > > > > to use it there i get an error of: > > > > > > > NoMethodError in Peoples#index > > > > > > Showing /index.html.erb where line #33 raised: > > > > > > undefined method `screen_name_contains'' for > > #<ActiveRecord::Relation: > > > > > > 0x10676f2a8> > > > > > > I think you need to put the model name --- so something like: > > > > > > photo_user_screen_name > > > > > > Where you are telling metasearch in a similar way that you would to > > AR > > > > about > > > > > the association to your current model, then the associated models > > field. > > > > > > > Controller: > > > > > > > def index > > > > > > @search = Account.search(params[:search]) > > > > > > @users = @search.where(:status => > > > > > > "active").page(params[:page]).per(24) > > > > > > end > > > > > > > Any advice ? > > > > > > > -- > > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > > For more options, visit this group at > > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > -- > > > > 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@googlegroups.com > > . > > > > To unsubscribe from this group, send email to > > > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > For more options, visit this group at > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, May 24, 2011 at 1:55 PM, Niklas Nson <niklasnson-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> wrote:> And no way of letting the PeopleController letting it know that it > should user Accounts ? >I am confused now what you are doing. If you want to search accounts you should be able (in any controller) do: @search = Account.seaarch(params[:search]) And then use the results> > /Niklas. > > On 24 Maj, 20:30, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > On Tue, May 24, 2011 at 1:14 PM, Niklas Nson <niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> > wrote: > > > I think i have mislead you with the subject line of this post. > > > Its not that Peoples are a releation of Accounts. Peoples are just a > > > Controller > > > to move the viewing parts account from AccountController. So the > > > problem is not how to do a > > > relation between two models; i need to get meta_search understand that > > > it should search the > > > Account (and then models associated to Account). I think i get the > > > error because it cant find > > > any model to search (which is correct; people doesn''t exists. > > > > Right... metasearch is pretty magical but does not have psychic abilities > :) > > > > > > > > > > > > > /Niklas > > > > > On 24 Maj, 18:51, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > > > On Tue, May 24, 2011 at 10:54 AM, Niklas Nson < > niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org > > > >wrote: > > > > > > > Thanks for your reply - sadly i cant get it working. > > > > > > > :routes => > > > > > match "/peoples" => "peoples#index", :as => "peoples" > > > > > > > Both accounts_ and _account results in > > > > > undefined method `account(s)_screen_name_contains'' for > > > > > #<ActiveRecord::Relation:0x106ae3da8> > > > > > > > Can i set up the relation in the controller ? > > > > > > Should not be a problem. First, have you seen the section > ''Multi-level > > > > associations'' onhttps://github.com/ernie/meta_search? > > > > > > If you still have trouble, probably easiest is post your current meta > > > search > > > > code and the models you are trying to associate, and their associated > > > schema > > > > (fields). > > > > > > > On 24 Maj, 17:05, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > > > > > On Tue, May 24, 2011 at 9:35 AM, Niklas Nson < > niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org > > > > > > > wrote: > > > > > > > Im in love with meta_search, a great gem but i have a question: > > > when > > > > > > > using it in controllers wich has the same name as the model > (Photo > > > => > > > > > > > PhotosController) it workes like a charm. But i have a > > > > > > > PeoplesController for handling accounts, profiles etc - and if > i > > > try > > > > > > > to use it there i get an error of: > > > > > > > > > NoMethodError in Peoples#index > > > > > > > Showing /index.html.erb where line #33 raised: > > > > > > > undefined method `screen_name_contains'' for > > > #<ActiveRecord::Relation: > > > > > > > 0x10676f2a8> > > > > > > > > I think you need to put the model name --- so something like: > > > > > > > > photo_user_screen_name > > > > > > > > Where you are telling metasearch in a similar way that you would > to > > > AR > > > > > about > > > > > > the association to your current model, then the associated models > > > field. > > > > > > > > > Controller: > > > > > > > > > def index > > > > > > > @search = Account.search(params[:search]) > > > > > > > @users = @search.where(:status => > > > > > > > "active").page(params[:page]).per(24) > > > > > > > end > > > > > > > > > Any advice ? > > > > > > > > > -- > > > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > > > For more options, visit this group at > > > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > > > -- > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > -- > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > For more options, visit this group at > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
This is what i got:
class PeoplesController < ApplicationController
def index
@search = Account.search(params[:search])
@users = @search.where(:status =>
"active").page(params[:page]).per(24)
end
end
class Account < ActiveRecord::Base
....
# screen_name :string(255)
....
end
[views/peoples/index.html.erb]
<% simple_form_for(:search, :url => peoples_path, :html => {:method
=> :get}) do |f| -%>
<%= f.input :screen_name_contains %>
<%= f.button :submit %>
<% end -%>
But this gets me:
NoMethodError in Peoples#index
Showing /Users/niklasnson/mugcube_app/mugcube/app/views/peoples/
index.html.erb where line #31 raised:
undefined method `screen_name_contains'' for
#<ActiveRecord::Relation:
0x107346c48>
The other two models/controllers i have been using was both the same
(photo and PhotoController and casting and CastingController) so i
thought that
the error was in that Account was the model and then a
PeoplesController. But after your last message i think this should not
matter ?
Grateful for all help,
/Niklas.
On 24 Maj, 21:30, David Kahn
<d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org>
wrote:> On Tue, May 24, 2011 at 1:55 PM, Niklas Nson
<niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> wrote:
> > And no way of letting the PeopleController letting it know that it
> > should user Accounts ?
>
> I am confused now what you are doing.
>
> If you want to search accounts you should be able (in any controller) do:
>
> @search = Account.seaarch(params[:search])
> And then use the results
>
>
>
>
>
> > /Niklas.
>
> > On 24 Maj, 20:30, David Kahn
<d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:
> > > On Tue, May 24, 2011 at 1:14 PM, Niklas Nson
<niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org>
> > wrote:
> > > > I think i have mislead you with the subject line of this
post.
> > > > Its not that Peoples are a releation of Accounts. Peoples
are just a
> > > > Controller
> > > > to move the viewing parts account from AccountController. So
the
> > > > problem is not how to do a
> > > > relation between two models; i need to get meta_search
understand that
> > > > it should search the
> > > > Account (and then models associated to Account). I think i
get the
> > > > error because it cant find
> > > > any model to search (which is correct; people
doesn''t exists.
>
> > > Right... metasearch is pretty magical but does not have psychic
abilities
> > :)
>
> > > > /Niklas
>
> > > > On 24 Maj, 18:51, David Kahn
<d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:
> > > > > On Tue, May 24, 2011 at 10:54 AM, Niklas Nson <
> > niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org
> > > > >wrote:
>
> > > > > > Thanks for your reply - sadly i cant get it
working.
>
> > > > > > :routes =>
> > > > > > match "/peoples" =>
"peoples#index", :as => "peoples"
>
> > > > > > Both accounts_ and _account results in
> > > > > > undefined method
`account(s)_screen_name_contains'' for
> > > > > > #<ActiveRecord::Relation:0x106ae3da8>
>
> > > > > > Can i set up the relation in the controller ?
>
> > > > > Should not be a problem. First, have you seen the
section
> > ''Multi-level
> > > > > associations''
onhttps://github.com/ernie/meta_search?
>
> > > > > If you still have trouble, probably easiest is post
your current meta
> > > > search
> > > > > code and the models you are trying to associate, and
their associated
> > > > schema
> > > > > (fields).
>
> > > > > > On 24 Maj, 17:05, David Kahn
<d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:
> > > > > > > On Tue, May 24, 2011 at 9:35 AM, Niklas Nson
<
> > niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org
>
> > > > > > wrote:
> > > > > > > > Im in love with meta_search, a great gem
but i have a question:
> > > > when
> > > > > > > > using it in controllers wich has the
same name as the model
> > (Photo
> > > > =>
> > > > > > > > PhotosController) it workes like a
charm. But i have a
> > > > > > > > PeoplesController for handling accounts,
profiles etc - and if
> > i
> > > > try
> > > > > > > > to use it there i get an error of:
>
> > > > > > > > NoMethodError in Peoples#index
> > > > > > > > Showing /index.html.erb where line #33
raised:
> > > > > > > > undefined method
`screen_name_contains'' for
> > > > #<ActiveRecord::Relation:
> > > > > > > > 0x10676f2a8>
>
> > > > > > > I think you need to put the model name --- so
something like:
>
> > > > > > > photo_user_screen_name
>
> > > > > > > Where you are telling metasearch in a similar
way that you would
> > to
> > > > AR
> > > > > > about
> > > > > > > the association to your current model, then
the associated models
> > > > field.
>
> > > > > > > > Controller:
>
> > > > > > > > def index
> > > > > > > > @search =
Account.search(params[:search])
> > > > > > > > @users = @search.where(:status =>
> > > > > > > >
"active").page(params[:page]).per(24)
> > > > > > > > end
>
> > > > > > > > Any advice ?
>
> > > > > > > > --
> > > > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > > > > > > > For more options, visit this group at
> > > > > > >
>http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> > > > > > --
> > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > > > > > For more options, visit this group at
> > > > >
>http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> > > > --
> > > > 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@googlegroups.com
> > .
> > > > To unsubscribe from this group, send email to
> > > >
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> > --
> > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To unsubscribe from this group, send email to
> >
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, May 24, 2011 at 3:05 PM, Niklas Nson <niklasnson-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> wrote:> This is what i got: > > class PeoplesController < ApplicationController > def index > @search = Account.search(params[:search]) > @users = @search.where(:status => > "active").page(params[:page]).per(24) > end > end > > class Account < ActiveRecord::Base > .... > # screen_name :string(255) > .... > end > > [views/peoples/index.html.erb] > <% simple_form_for(:search, :url => peoples_path, :html => {:method > => :get}) do |f| -%> > <%= f.input :screen_name_contains %> > <%= f.button :submit %> > <% end -%> >So I am assuming your Account model has a screen_name attribute, correct? Can you post here the params which your controller is receiving when you post this form? I am assuming that there is probably some conflict in the params where you might have something like params[:people][:screen_name]... and of course metasearch is not going to find it.... you will need to make the input params to be what meta search would expect.... and ideally make your form based on the account model like: @account = Account.new # just used for the search form_for @account f.text_field :screen_name ... Otherwise you can do what I have done in the past which is to create a form however you want and then marry the params to metasearch in the model. But I would not recommend this until you understand what is going on.> > But this gets me: > NoMethodError in Peoples#index > Showing /Users/niklasnson/mugcube_app/mugcube/app/views/peoples/ > index.html.erb where line #31 raised: > undefined method `screen_name_contains'' for #<ActiveRecord::Relation: > 0x107346c48> > > The other two models/controllers i have been using was both the same > (photo and PhotoController and casting and CastingController) so i > thought that > the error was in that Account was the model and then a > PeoplesController. But after your last message i think this should not > matter ? > > Grateful for all help, > /Niklas. > > > On 24 Maj, 21:30, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > On Tue, May 24, 2011 at 1:55 PM, Niklas Nson <niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> > wrote: > > > And no way of letting the PeopleController letting it know that it > > > should user Accounts ? > > > > I am confused now what you are doing. > > > > If you want to search accounts you should be able (in any controller) do: > > > > @search = Account.seaarch(params[:search]) > > And then use the results > > > > > > > > > > > > > /Niklas. > > > > > On 24 Maj, 20:30, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > > > On Tue, May 24, 2011 at 1:14 PM, Niklas Nson <niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org > > > > > wrote: > > > > > I think i have mislead you with the subject line of this post. > > > > > Its not that Peoples are a releation of Accounts. Peoples are just > a > > > > > Controller > > > > > to move the viewing parts account from AccountController. So the > > > > > problem is not how to do a > > > > > relation between two models; i need to get meta_search understand > that > > > > > it should search the > > > > > Account (and then models associated to Account). I think i get the > > > > > error because it cant find > > > > > any model to search (which is correct; people doesn''t exists. > > > > > > Right... metasearch is pretty magical but does not have psychic > abilities > > > :) > > > > > > > /Niklas > > > > > > > On 24 Maj, 18:51, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > > > > > On Tue, May 24, 2011 at 10:54 AM, Niklas Nson < > > > niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org > > > > > >wrote: > > > > > > > > > Thanks for your reply - sadly i cant get it working. > > > > > > > > > :routes => > > > > > > > match "/peoples" => "peoples#index", :as => "peoples" > > > > > > > > > Both accounts_ and _account results in > > > > > > > undefined method `account(s)_screen_name_contains'' for > > > > > > > #<ActiveRecord::Relation:0x106ae3da8> > > > > > > > > > Can i set up the relation in the controller ? > > > > > > > > Should not be a problem. First, have you seen the section > > > ''Multi-level > > > > > > associations'' onhttps://github.com/ernie/meta_search? > > > > > > > > If you still have trouble, probably easiest is post your current > meta > > > > > search > > > > > > code and the models you are trying to associate, and their > associated > > > > > schema > > > > > > (fields). > > > > > > > > > On 24 Maj, 17:05, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> > wrote: > > > > > > > > On Tue, May 24, 2011 at 9:35 AM, Niklas Nson < > > > niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org > > > > > > > > > wrote: > > > > > > > > > Im in love with meta_search, a great gem but i have a > question: > > > > > when > > > > > > > > > using it in controllers wich has the same name as the model > > > (Photo > > > > > => > > > > > > > > > PhotosController) it workes like a charm. But i have a > > > > > > > > > PeoplesController for handling accounts, profiles etc - and > if > > > i > > > > > try > > > > > > > > > to use it there i get an error of: > > > > > > > > > > > NoMethodError in Peoples#index > > > > > > > > > Showing /index.html.erb where line #33 raised: > > > > > > > > > undefined method `screen_name_contains'' for > > > > > #<ActiveRecord::Relation: > > > > > > > > > 0x10676f2a8> > > > > > > > > > > I think you need to put the model name --- so something like: > > > > > > > > > > photo_user_screen_name > > > > > > > > > > Where you are telling metasearch in a similar way that you > would > > > to > > > > > AR > > > > > > > about > > > > > > > > the association to your current model, then the associated > models > > > > > field. > > > > > > > > > > > Controller: > > > > > > > > > > > def index > > > > > > > > > @search = Account.search(params[:search]) > > > > > > > > > @users = @search.where(:status => > > > > > > > > > "active").page(params[:page]).per(24) > > > > > > > > > end > > > > > > > > > > > Any advice ? > > > > > > > > > > > -- > > > > > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > > > > > For more options, visit this group at > > > > > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > > > > > -- > > > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > > > For more options, visit this group at > > > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > > > -- > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > -- > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > For more options, visit this group at > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I get the error
NoMethodError in Peoples#index
Showing /Users/niklasnson/mugcube_app/mugcube/app/views/peoples/
index.html.erb where line #32 raised:
undefined method `screen_name_contains'' for
#<Account:0x1066e2ab0>
Directly when i try to acccess the page so i cant post the form.
Tryed
<% @account = Account.new # just used for the search %>
<% simple_form_for(:search, @account, :html => {:method => :get}) do |
f| -%>
<%= f.input :screen_name_contains %>
<%= f.button :submit %>
<% end -%>
But that resulted in the same error.
On 24 Maj, 22:51, David Kahn
<d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org>
wrote:> On Tue, May 24, 2011 at 3:05 PM, Niklas Nson
<niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> wrote:
> > This is what i got:
>
> > class PeoplesController < ApplicationController
> > def index
> > @search = Account.search(params[:search])
> > @users = @search.where(:status =>
> > "active").page(params[:page]).per(24)
> > end
> > end
>
> > class Account < ActiveRecord::Base
> > ....
> > # screen_name :string(255)
> > ....
> > end
>
> > [views/peoples/index.html.erb]
> > <% simple_form_for(:search, :url => peoples_path, :html =>
{:method
> > => :get}) do |f| -%>
> > <%= f.input :screen_name_contains %>
> > <%= f.button :submit %>
> > <% end -%>
>
> So I am assuming your Account model has a screen_name attribute, correct?
> Can you post here the params which your controller is receiving when you
> post this form? I am assuming that there is probably some conflict in the
> params where you might have something like params[:people][:screen_name]...
> and of course metasearch is not going to find it.... you will need to make
> the input params to be what meta search would expect.... and ideally make
> your form based on the account model like:
>
> @account = Account.new # just used for the search
> form_for @account
> f.text_field :screen_name
> ...
>
> Otherwise you can do what I have done in the past which is to create a form
> however you want and then marry the params to metasearch in the model. But
I
> would not recommend this until you understand what is going on.
>
>
>
>
>
> > But this gets me:
> > NoMethodError in Peoples#index
> > Showing /Users/niklasnson/mugcube_app/mugcube/app/views/peoples/
> > index.html.erb where line #31 raised:
> > undefined method `screen_name_contains'' for
#<ActiveRecord::Relation:
> > 0x107346c48>
>
> > The other two models/controllers i have been using was both the same
> > (photo and PhotoController and casting and CastingController) so i
> > thought that
> > the error was in that Account was the model and then a
> > PeoplesController. But after your last message i think this should not
> > matter ?
>
> > Grateful for all help,
> > /Niklas.
>
> > On 24 Maj, 21:30, David Kahn
<d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:
> > > On Tue, May 24, 2011 at 1:55 PM, Niklas Nson
<niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org>
> > wrote:
> > > > And no way of letting the PeopleController letting it know
that it
> > > > should user Accounts ?
>
> > > I am confused now what you are doing.
>
> > > If you want to search accounts you should be able (in any
controller) do:
>
> > > @search = Account.seaarch(params[:search])
> > > And then use the results
>
> > > > /Niklas.
>
> > > > On 24 Maj, 20:30, David Kahn
<d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:
> > > > > On Tue, May 24, 2011 at 1:14 PM, Niklas Nson
<niklasn...@meantime.se
>
> > > > wrote:
> > > > > > I think i have mislead you with the subject line
of this post.
> > > > > > Its not that Peoples are a releation of Accounts.
Peoples are just
> > a
> > > > > > Controller
> > > > > > to move the viewing parts account from
AccountController. So the
> > > > > > problem is not how to do a
> > > > > > relation between two models; i need to get
meta_search understand
> > that
> > > > > > it should search the
> > > > > > Account (and then models associated to Account). I
think i get the
> > > > > > error because it cant find
> > > > > > any model to search (which is correct; people
doesn''t exists.
>
> > > > > Right... metasearch is pretty magical but does not have
psychic
> > abilities
> > > > :)
>
> > > > > > /Niklas
>
> > > > > > On 24 Maj, 18:51, David Kahn
<d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote:
> > > > > > > On Tue, May 24, 2011 at 10:54 AM, Niklas Nson
<
> > > > niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org
> > > > > > >wrote:
>
> > > > > > > > Thanks for your reply - sadly i cant get
it working.
>
> > > > > > > > :routes =>
> > > > > > > > match "/peoples" =>
"peoples#index", :as => "peoples"
>
> > > > > > > > Both accounts_ and _account results in
> > > > > > > > undefined method
`account(s)_screen_name_contains'' for
> > > > > > > >
#<ActiveRecord::Relation:0x106ae3da8>
>
> > > > > > > > Can i set up the relation in the
controller ?
>
> > > > > > > Should not be a problem. First, have you seen
the section
> > > > ''Multi-level
> > > > > > > associations''
onhttps://github.com/ernie/meta_search?
>
> > > > > > > If you still have trouble, probably easiest
is post your current
> > meta
> > > > > > search
> > > > > > > code and the models you are trying to
associate, and their
> > associated
> > > > > > schema
> > > > > > > (fields).
>
> > > > > > > > On 24 Maj, 17:05, David Kahn
<d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org>
> > wrote:
> > > > > > > > > On Tue, May 24, 2011 at 9:35 AM,
Niklas Nson <
> > > > niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org
>
> > > > > > > > wrote:
> > > > > > > > > > Im in love with meta_search, a
great gem but i have a
> > question:
> > > > > > when
> > > > > > > > > > using it in controllers wich
has the same name as the model
> > > > (Photo
> > > > > > =>
> > > > > > > > > > PhotosController) it workes
like a charm. But i have a
> > > > > > > > > > PeoplesController for handling
accounts, profiles etc - and
> > if
> > > > i
> > > > > > try
> > > > > > > > > > to use it there i get an error
of:
>
> > > > > > > > > > NoMethodError in Peoples#index
> > > > > > > > > > Showing /index.html.erb where
line #33 raised:
> > > > > > > > > > undefined method
`screen_name_contains'' for
> > > > > > #<ActiveRecord::Relation:
> > > > > > > > > > 0x10676f2a8>
>
> > > > > > > > > I think you need to put the model
name --- so something like:
>
> > > > > > > > > photo_user_screen_name
>
> > > > > > > > > Where you are telling metasearch in
a similar way that you
> > would
> > > > to
> > > > > > AR
> > > > > > > > about
> > > > > > > > > the association to your current
model, then the associated
> > models
> > > > > > field.
>
> > > > > > > > > > Controller:
>
> > > > > > > > > > def index
> > > > > > > > > > @search =
Account.search(params[:search])
> > > > > > > > > > @users =
@search.where(:status =>
> > > > > > > > > >
"active").page(params[:page]).per(24)
> > > > > > > > > > end
>
> > > > > > > > > > Any advice ?
>
> > > > > > > > > > --
> > > > > > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > > > > > > > > > For more options, visit this
group at
> > > > > > > > >
>http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> > > > > > > > --
> > > > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > > > > > > > For more options, visit this group at
> > > > > > >
>http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> > > > > > --
> > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > > > > > For more options, visit this group at
> > > > >
>http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> > > > --
> > > > 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@googlegroups.com
> > .
> > > > To unsubscribe from this group, send email to
> > > >
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> > --
> > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To unsubscribe from this group, send email to
> >
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On Wed, May 25, 2011 at 12:08 AM, Niklas Nson <niklasnson-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org>wrote:> I get the error > NoMethodError in Peoples#index > Showing /Users/niklasnson/mugcube_app/mugcube/app/views/peoples/ > index.html.erb where line #32 raised: > undefined method `screen_name_contains'' for #<Account:0x1066e2ab0> > > Directly when i try to acccess the page so i cant post the form. > Tryed > > <% @account = Account.new # just used for the search %> > <% simple_form_for(:search, @account, :html => {:method => :get}) do > | > f| -%> > <%= f.input :screen_name_contains %> > <%= f.button :submit %> > <% end -%> > > But that resulted in the same error. >Again please copy the params from the server console on the post. Also, try using account_screen_name_contains... maybe.> > > > > On 24 Maj, 22:51, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > On Tue, May 24, 2011 at 3:05 PM, Niklas Nson <niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> > wrote: > > > This is what i got: > > > > > class PeoplesController < ApplicationController > > > def index > > > @search = Account.search(params[:search]) > > > @users = @search.where(:status => > > > "active").page(params[:page]).per(24) > > > end > > > end > > > > > class Account < ActiveRecord::Base > > > .... > > > # screen_name :string(255) > > > .... > > > end > > > > > [views/peoples/index.html.erb] > > > <% simple_form_for(:search, :url => peoples_path, :html => {:method > > > => :get}) do |f| -%> > > > <%= f.input :screen_name_contains %> > > > <%= f.button :submit %> > > > <% end -%> > > > > So I am assuming your Account model has a screen_name attribute, correct? > > Can you post here the params which your controller is receiving when you > > post this form? I am assuming that there is probably some conflict in the > > params where you might have something like > params[:people][:screen_name]... > > and of course metasearch is not going to find it.... you will need to > make > > the input params to be what meta search would expect.... and ideally make > > your form based on the account model like: > > > > @account = Account.new # just used for the search > > form_for @account > > f.text_field :screen_name > > ... > > > > Otherwise you can do what I have done in the past which is to create a > form > > however you want and then marry the params to metasearch in the model. > But I > > would not recommend this until you understand what is going on. > > > > > > > > > > > > > But this gets me: > > > NoMethodError in Peoples#index > > > Showing /Users/niklasnson/mugcube_app/mugcube/app/views/peoples/ > > > index.html.erb where line #31 raised: > > > undefined method `screen_name_contains'' for #<ActiveRecord::Relation: > > > 0x107346c48> > > > > > The other two models/controllers i have been using was both the same > > > (photo and PhotoController and casting and CastingController) so i > > > thought that > > > the error was in that Account was the model and then a > > > PeoplesController. But after your last message i think this should not > > > matter ? > > > > > Grateful for all help, > > > /Niklas. > > > > > On 24 Maj, 21:30, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > > > On Tue, May 24, 2011 at 1:55 PM, Niklas Nson <niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org > > > > > wrote: > > > > > And no way of letting the PeopleController letting it know that it > > > > > should user Accounts ? > > > > > > I am confused now what you are doing. > > > > > > If you want to search accounts you should be able (in any controller) > do: > > > > > > @search = Account.seaarch(params[:search]) > > > > And then use the results > > > > > > > /Niklas. > > > > > > > On 24 Maj, 20:30, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: > > > > > > On Tue, May 24, 2011 at 1:14 PM, Niklas Nson < > niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org > > > > > > > wrote: > > > > > > > I think i have mislead you with the subject line of this post. > > > > > > > Its not that Peoples are a releation of Accounts. Peoples are > just > > > a > > > > > > > Controller > > > > > > > to move the viewing parts account from AccountController. So > the > > > > > > > problem is not how to do a > > > > > > > relation between two models; i need to get meta_search > understand > > > that > > > > > > > it should search the > > > > > > > Account (and then models associated to Account). I think i get > the > > > > > > > error because it cant find > > > > > > > any model to search (which is correct; people doesn''t exists. > > > > > > > > Right... metasearch is pretty magical but does not have psychic > > > abilities > > > > > :) > > > > > > > > > /Niklas > > > > > > > > > On 24 Maj, 18:51, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> > wrote: > > > > > > > > On Tue, May 24, 2011 at 10:54 AM, Niklas Nson < > > > > > niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org > > > > > > > >wrote: > > > > > > > > > > > Thanks for your reply - sadly i cant get it working. > > > > > > > > > > > :routes => > > > > > > > > > match "/peoples" => "peoples#index", :as => "peoples" > > > > > > > > > > > Both accounts_ and _account results in > > > > > > > > > undefined method `account(s)_screen_name_contains'' for > > > > > > > > > #<ActiveRecord::Relation:0x106ae3da8> > > > > > > > > > > > Can i set up the relation in the controller ? > > > > > > > > > > Should not be a problem. First, have you seen the section > > > > > ''Multi-level > > > > > > > > associations'' onhttps://github.com/ernie/meta_search? > > > > > > > > > > If you still have trouble, probably easiest is post your > current > > > meta > > > > > > > search > > > > > > > > code and the models you are trying to associate, and their > > > associated > > > > > > > schema > > > > > > > > (fields). > > > > > > > > > > > On 24 Maj, 17:05, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> > > > wrote: > > > > > > > > > > On Tue, May 24, 2011 at 9:35 AM, Niklas Nson < > > > > > niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org > > > > > > > > > > > wrote: > > > > > > > > > > > Im in love with meta_search, a great gem but i have a > > > question: > > > > > > > when > > > > > > > > > > > using it in controllers wich has the same name as the > model > > > > > (Photo > > > > > > > => > > > > > > > > > > > PhotosController) it workes like a charm. But i have a > > > > > > > > > > > PeoplesController for handling accounts, profiles etc - > and > > > if > > > > > i > > > > > > > try > > > > > > > > > > > to use it there i get an error of: > > > > > > > > > > > > > NoMethodError in Peoples#index > > > > > > > > > > > Showing /index.html.erb where line #33 raised: > > > > > > > > > > > undefined method `screen_name_contains'' for > > > > > > > #<ActiveRecord::Relation: > > > > > > > > > > > 0x10676f2a8> > > > > > > > > > > > > I think you need to put the model name --- so something > like: > > > > > > > > > > > > photo_user_screen_name > > > > > > > > > > > > Where you are telling metasearch in a similar way that > you > > > would > > > > > to > > > > > > > AR > > > > > > > > > about > > > > > > > > > > the association to your current model, then the > associated > > > models > > > > > > > field. > > > > > > > > > > > > > Controller: > > > > > > > > > > > > > def index > > > > > > > > > > > @search = Account.search(params[:search]) > > > > > > > > > > > @users = @search.where(:status => > > > > > > > > > > > "active").page(params[:page]).per(24) > > > > > > > > > > > end > > > > > > > > > > > > > Any advice ? > > > > > > > > > > > > > -- > > > > > > > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > > > > > > > For more options, visit this group at > > > > > > > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > > > > > > > -- > > > > > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > > > > > For more options, visit this group at > > > > > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > > > > > -- > > > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > > > For more options, visit this group at > > > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > > > -- > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > -- > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > For more options, visit this group at > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Wed, May 25, 2011 at 10:08 AM, David Kahn <dk-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org>wrote:> > > On Wed, May 25, 2011 at 12:08 AM, Niklas Nson <niklasnson-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org>wrote: > >> I get the error >> NoMethodError in Peoples#index >> Showing /Users/niklasnson/mugcube_app/mugcube/app/views/peoples/ >> index.html.erb where line #32 raised: >> undefined method `screen_name_contains'' for #<Account:0x1066e2ab0> >> >> Directly when i try to acccess the page so i cant post the form. >> Tryed >> >> <% @account = Account.new # just used for the search %> >> <% simple_form_for(:search, @account, :html => {:method => :get}) >> do | >> f| -%> >> <%= f.input :screen_name_contains %> >> <%= f.button :submit %> >> <% end -%> >> >> But that resulted in the same error. >> > > Again please copy the params from the server console on the post. Also, try > using account_screen_name_contains... maybe. >One other idea is to simplify, so start in the account controller and model and do a simple search following exactly the code on the metasearch github. Once you get that working right get more creative, and go for what you are trying. In the end this will save you time and at least you get on the right path.> >> >> >> >> On 24 Maj, 22:51, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: >> > On Tue, May 24, 2011 at 3:05 PM, Niklas Nson <niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> >> wrote: >> > > This is what i got: >> > >> > > class PeoplesController < ApplicationController >> > > def index >> > > @search = Account.search(params[:search]) >> > > @users = @search.where(:status => >> > > "active").page(params[:page]).per(24) >> > > end >> > > end >> > >> > > class Account < ActiveRecord::Base >> > > .... >> > > # screen_name :string(255) >> > > .... >> > > end >> > >> > > [views/peoples/index.html.erb] >> > > <% simple_form_for(:search, :url => peoples_path, :html => {:method >> > > => :get}) do |f| -%> >> > > <%= f.input :screen_name_contains %> >> > > <%= f.button :submit %> >> > > <% end -%> >> > >> > So I am assuming your Account model has a screen_name attribute, >> correct? >> > Can you post here the params which your controller is receiving when you >> > post this form? I am assuming that there is probably some conflict in >> the >> > params where you might have something like >> params[:people][:screen_name]... >> > and of course metasearch is not going to find it.... you will need to >> make >> > the input params to be what meta search would expect.... and ideally >> make >> > your form based on the account model like: >> > >> > @account = Account.new # just used for the search >> > form_for @account >> > f.text_field :screen_name >> > ... >> > >> > Otherwise you can do what I have done in the past which is to create a >> form >> > however you want and then marry the params to metasearch in the model. >> But I >> > would not recommend this until you understand what is going on. >> > >> > >> > >> > >> > >> > > But this gets me: >> > > NoMethodError in Peoples#index >> > > Showing /Users/niklasnson/mugcube_app/mugcube/app/views/peoples/ >> > > index.html.erb where line #31 raised: >> > > undefined method `screen_name_contains'' for #<ActiveRecord::Relation: >> > > 0x107346c48> >> > >> > > The other two models/controllers i have been using was both the same >> > > (photo and PhotoController and casting and CastingController) so i >> > > thought that >> > > the error was in that Account was the model and then a >> > > PeoplesController. But after your last message i think this should not >> > > matter ? >> > >> > > Grateful for all help, >> > > /Niklas. >> > >> > > On 24 Maj, 21:30, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: >> > > > On Tue, May 24, 2011 at 1:55 PM, Niklas Nson < >> niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org> >> > > wrote: >> > > > > And no way of letting the PeopleController letting it know that it >> > > > > should user Accounts ? >> > >> > > > I am confused now what you are doing. >> > >> > > > If you want to search accounts you should be able (in any >> controller) do: >> > >> > > > @search = Account.seaarch(params[:search]) >> > > > And then use the results >> > >> > > > > /Niklas. >> > >> > > > > On 24 Maj, 20:30, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> wrote: >> > > > > > On Tue, May 24, 2011 at 1:14 PM, Niklas Nson < >> niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org >> > >> > > > > wrote: >> > > > > > > I think i have mislead you with the subject line of this post. >> > > > > > > Its not that Peoples are a releation of Accounts. Peoples are >> just >> > > a >> > > > > > > Controller >> > > > > > > to move the viewing parts account from AccountController. So >> the >> > > > > > > problem is not how to do a >> > > > > > > relation between two models; i need to get meta_search >> understand >> > > that >> > > > > > > it should search the >> > > > > > > Account (and then models associated to Account). I think i get >> the >> > > > > > > error because it cant find >> > > > > > > any model to search (which is correct; people doesn''t exists. >> > >> > > > > > Right... metasearch is pretty magical but does not have psychic >> > > abilities >> > > > > :) >> > >> > > > > > > /Niklas >> > >> > > > > > > On 24 Maj, 18:51, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org> >> wrote: >> > > > > > > > On Tue, May 24, 2011 at 10:54 AM, Niklas Nson < >> > > > > niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org >> > > > > > > >wrote: >> > >> > > > > > > > > Thanks for your reply - sadly i cant get it working. >> > >> > > > > > > > > :routes => >> > > > > > > > > match "/peoples" => "peoples#index", :as => "peoples" >> > >> > > > > > > > > Both accounts_ and _account results in >> > > > > > > > > undefined method `account(s)_screen_name_contains'' for >> > > > > > > > > #<ActiveRecord::Relation:0x106ae3da8> >> > >> > > > > > > > > Can i set up the relation in the controller ? >> > >> > > > > > > > Should not be a problem. First, have you seen the section >> > > > > ''Multi-level >> > > > > > > > associations'' onhttps://github.com/ernie/meta_search? >> > >> > > > > > > > If you still have trouble, probably easiest is post your >> current >> > > meta >> > > > > > > search >> > > > > > > > code and the models you are trying to associate, and their >> > > associated >> > > > > > > schema >> > > > > > > > (fields). >> > >> > > > > > > > > On 24 Maj, 17:05, David Kahn <d...-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org >> > >> > > wrote: >> > > > > > > > > > On Tue, May 24, 2011 at 9:35 AM, Niklas Nson < >> > > > > niklasn...-5ZBJkHaGu7EwFerOooGFRg@public.gmane.org >> > >> > > > > > > > > wrote: >> > > > > > > > > > > Im in love with meta_search, a great gem but i have a >> > > question: >> > > > > > > when >> > > > > > > > > > > using it in controllers wich has the same name as the >> model >> > > > > (Photo >> > > > > > > => >> > > > > > > > > > > PhotosController) it workes like a charm. But i have a >> > > > > > > > > > > PeoplesController for handling accounts, profiles etc >> - and >> > > if >> > > > > i >> > > > > > > try >> > > > > > > > > > > to use it there i get an error of: >> > >> > > > > > > > > > > NoMethodError in Peoples#index >> > > > > > > > > > > Showing /index.html.erb where line #33 raised: >> > > > > > > > > > > undefined method `screen_name_contains'' for >> > > > > > > #<ActiveRecord::Relation: >> > > > > > > > > > > 0x10676f2a8> >> > >> > > > > > > > > > I think you need to put the model name --- so something >> like: >> > >> > > > > > > > > > photo_user_screen_name >> > >> > > > > > > > > > Where you are telling metasearch in a similar way that >> you >> > > would >> > > > > to >> > > > > > > AR >> > > > > > > > > about >> > > > > > > > > > the association to your current model, then the >> associated >> > > models >> > > > > > > field. >> > >> > > > > > > > > > > Controller: >> > >> > > > > > > > > > > def index >> > > > > > > > > > > @search = Account.search(params[:search]) >> > > > > > > > > > > @users = @search.where(:status => >> > > > > > > > > > > "active").page(params[:page]).per(24) >> > > > > > > > > > > end >> > >> > > > > > > > > > > Any advice ? >> > >> > > > > > > > > > > -- >> > > > > > > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > > > > > > > > > > For more options, visit this group at >> > > > > > > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. >> > >> > > > > > > > > -- >> > > > > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > > > > > > > > For more options, visit this group at >> > > > > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. >> > >> > > > > > > -- >> > > > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > > > > > > For more options, visit this group at >> > > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. >> > >> > > > > -- >> > > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > > > > For more options, visit this group at >> > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. >> > >> > > -- >> > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > > To unsubscribe from this group, send email to >> > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > > For more options, visit this group at >> > >http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.