ruby on rails - Ransack : Undefined Method "result" -


i need use ransack , install gem , restart server , writed in controller :

def index

  @q = sound.search(params[:q])       @sounds = @q.result 

end

and in view :

    <%= f.label :title_cont %>     <%= f.text_field :title_cont %>       <%= f.submit "search" %> 

but have error :

undefined method `result' #activerecord::relation:0x007fa185e9c2c0>

i try found answer doesn't work.

thanks help

edit : find solution , use other gem : sunspot , work.

thank's help.

i have had same issue.

i found solution here https://github.com/activerecord-hackery/ransack/issues/266

i changed

@q = sound.search(params[:q]) @sounds = @q.result 

to

@q = sound.ransack(params[:q]) @sounds = @q.result 

i think activeadmin had overwritten search method so, explained in link above, ransack method has been created run search in case gem has used 'search'.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -