Searching for two arguments Ruby on Rails -
I am working on search with two text areas. It searches two things (now location and details) and only displays entries (listings) that match them, I also want to search for other text fields for the title, so it should see the details and title. How will this work?
What is it now
listing.rb
def self.locsearch (search_location, search_description) refund back to search_location.present until scanned? || Search_description.present? Where (['Like place and details like?', '% # {Search_location}% ","% # {search_description}% "] end home.html.erb
& lt;% = form_tag findjobs_path ,: Controller = & gt; 'listing' ,: Action => 'Public Search', Method :: do% & gt; & lt; % = Text_field_tag: location, parameter [: location]%> gt; title = text_field_tag: descripiton, params [: descripiton]%> & lt;% = submit_tag "search", name: zero% & gt; listing_controller.rb def index @ listing = @ listing. (Parameter [: location], parameters [: description] ]) End its Apart from this, my methodology uses now or condition. How do I apply the "and" status? (If I change & I get an error "undefined method or variable scroped)
Are you sure you want to use Unless that will be used only when you want to execute the specified code if the situation (status) is false. and scod are used with a model. Model.scoped you or
you can write return scod if you < Code> scoped can be defined as a local variable or a method. > You can view
Comments
Post a Comment