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...@structuralartistry.com> wrote:
> > On Tue, May 24, 2011 at 10:54 AM, Niklas Nson <niklasn...@meantime.se
> >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...@structuralartistry.com> 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@googlegroups.com
> > > .
> > > > > To unsubscribe from this group, send email to
> > > > > rubyonrails-talk+unsubscr...@googlegroups.com.
> > > > > 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+unsubscr...@googlegroups.com.
> > > 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+unsubscr...@googlegroups.com.
> 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to