RailsCasts Pro episodes are now free!

Learn more or hide this

user's Profile

GitHub User: fiatlux

Comments by user

Avatar

I'm trying to build a search form capable of full text searching as well as narrowing down based on booleans using Sunspot. However, i'm not able to get it working and the filter doesn't happen. Any input would be appreciated:

@search = Project.search do
   fulltext params[:search]
   facet(:master_bedroom)
   facet(:dining_room)
   facet(:bath)
   with(:master_bedroom, params[:mb]) if params[:mb].present?
   with(:dining_room, params[:dr]) if params[:dr].present?
   with(:bath, params[:p_bath]) if params[:p_bath].present?
 end    

i have the fields in the model:

searchable do
text :description
boolean :dining_room
boolean :bath
boolean :master_bedroom
end

and i have the following for my view:

<%= form_tag projects_path, :method => :get do %>

<%= text_field_tag :search, params[:search] %>
<%= check_box_tag :bath, 'true'%>
<%= submit_tag "Search", :name => nil %>

<% end %>

Avatar

Great videos!

I have a question on Devise. In this video, it seems that we created our base use model from what devise wanted.

I have another model, skills, that i want to do a many to many through association with the user model.

i have two concerns:

1) i'm using a third party user model (devise) and don't want to edit it significantly for fear that it may lock me into big changes later on.

2) i want to create a set of checkboxes like in your habtm videos, but i'm not sure if i should use the devise based model or create it through the skills controller. i'm editing a user's skills so i'm a little confused on how to do it. any thoughts?

thanks!