How to use Rails select with ransack -


i need use rails select method oppose *text_field* search legacy data. unfortunately, 1 of attributes in project's table capitalized, , if use alias_attribute on it, still complains correct naming actual table. code blow works point, instead of passing project_cont name value in params, id description. how can make work? here current code have @ moment:

 = search_form_for @search, :html => {:class => "form-inline"} |f|       .form-group         = f.select :decsription_cont, options_from_collection_for_select(project.all, "id","description", @search) 

here controller's code:

     def index       @search = project.search(params[:q])       @products = @search.result     end    
here view's code:

    = search_form_for @search, :html => {:class => "form-inline"} |f|      = f.select :decsription_cont, options_from_collection_for_select(project.all, "id","description", @search.description_cont)      = f.submit   

you should add description_cont @search, as

f.select :decsription_cont, options_from_collection_for_select(project.all, "id","description", @search.description_cont) 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -