Sign in through GitHub

RailsCasts Pro episodes are now free!

Learn more or hide this

SaurabhBhat1206's Profile

GitHub User: SaurabhBhat1206

Comments by

Avatar

Hi i have to search the attributes which is there in some other model and i want to search multiple attributes

index view

<%= form_tag issue_slips_path, :method => 'get' do %>

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

<%end%>

controller

@issue_slip = IssueSlip.search(params[:search])

model
def self.search(search)
if search
find(:all, :conditions => ['store_location_id LIKE :search ', {:search => "%#{search}%"}])
else
find(:all)
end
end

the store location name is what i have to search but i have only the id, how to search the name which is there in another StoreLocation model please help

Avatar

but when we run the "rails g integration_test task" command it automatically generates the spec/requests folder so how to change it to spec/features folder? Please help