On Feb 22, 2012, at 10:43 AM, Roger Patrick wrote: > Hey I installed the ransack gem and have added some basic code to my > code but have received an error now on my page which is the followin > > undefined method `result' for #<Array:0x44cd540> > > I have the following code in my gamescontroller.rb > > def index > @q = Game.search(params[:q]) > @game = @q.result(:distinct => true) > end > > > and the following code in my games/index.html.erb > > <%= search_form_for @q do |f| %> > > <%= f.label :game_name_start %> > <%= f.text_field :game_name_start %> > <%= f.submit %> > <% end %> > > any ideas of what the problem might be? >
Didn't you have a search method that you wrote earlier? That may be overriding the one in the Ransack gem. Ransack returns an Arel collection, not an array. Walter > -- > 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 post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

