Search bar does not work unless i Refresh the page
up vote
0
down vote
favorite
I have an issue where I have a search bar that searches my database via names and location. This does work. However, I have to actually refresh the page most of the time in order for it to work. I've tried placing it in another page, but it seems as if the issue carries over. Any ideas?
Application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Rumordom</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all',
'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<script src="//maps.google.com/maps/api/js?key=AIzaSyCyWj7qH1UB7GHF5HAi6OsphBRePFnO0FcwlyTA"></script>
<script src="//cdn.rawgit.com/mahnunchik/markerclustererplus/master/dist/markerclusterer.min.js"></script>
<script src='//cdn.rawgit.com/printercu/google-maps-utility-library-v3-read-only/master/infobox/src/infobox_packed.js' type='text/javascript'></script>
<script src='//underscorejs.org/underscore-min.js' type='text/javascript'></script>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<%= render 'search/form' %>
<div class="container">
<% flash.each do |message_type, message| %>
<%= content_tag(:div, message, class: "alert alert-#message_type") %>
<% end %>
<%= yield %>
<%= render 'layouts/footer' %>
</div>
</body>
</html>
Main Home page
<% if logged_in? %>
<div class="row">
<aside class="col-md-4">
<section class="user_info">
<%= render 'shared/user_info' %>
</section>
<section class="stats">
<%= render 'shared/stats' %>
<%= render 'users/follow_form' if logged_in? %>
</section>
<%= link_to "Create a Business", businesses_new_path, class: "btn btn-lg btn-primary" %>
</aside>
<div class="col-md-8">
<h3>Experience Feed(Businesses) <%= link_to "Users", user_feed_path, class: "btn btn-lg btn-primary" %></h3>
<%= render 'shared/feed' %>
</div>
</div>
<% else %>
<div class="main_message">
<font color=#8c1aff font-weight: "bold" background-color: "purple">Rumordom</font>
</div>
<p>Welcome to Rumordom. This is a website where you can write about an experience you've had with a business. <strong>Every Experience Matters</strong> and someone should know about it. Click <%= link_to "HERE", about_path %> for more information about <font color=#8c1aff size="3em" font-weight: "bold">Rumordom</font>.</p>
<div>
<%= link_to "Sign up now!", signup_path, class: "btn btn-lg btn-primary" %>
<%= link_to "Write about an Experience", new_business_path, class: "btn btn-lg btn-primary" %>
</div>
<% end %>
Search form
<div class="span2">
<div class="search-form" >
<div class="before-buttons", style="font-size:1.2em;">
<%= form_tag search_businesses_path, method: :get do |f| %>
<%= text_field_tag :search, nil, placeholder: "Search for A Business....write about your recent customer experience" %>
<div class="location_search">
<%= text_field_tag :location, nil, placeholder: "denver, miami, etc." %>
</div>
</div>
<div class="buttons">
<%= submit_tag "Search", class: "btn btn-md btn-primary" %>
</div>
<% end %>
</div>
Search Controller
class SearchController < ApplicationController
def search
if params[:term].nil?
@businesses =
else
@businesses = Article.search params[:term]
end
end
end
Main Search Function
def self.search(params)
#businesses = Business.where(category_id: params[:category].to_i)
businesses = Business.where("name like ? or city like ? or state like ?", "%#params[:search]%", "%#params[:search]%", "%#params[:search]%") if params[:search].present?
businesses = businesses.within(20, :origin => "#params[:location]")
businesses = businesses.sort_byx
businesses
end
end
ruby-on-rails google-maps ruby-on-rails-5 geokit
add a comment |
up vote
0
down vote
favorite
I have an issue where I have a search bar that searches my database via names and location. This does work. However, I have to actually refresh the page most of the time in order for it to work. I've tried placing it in another page, but it seems as if the issue carries over. Any ideas?
Application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Rumordom</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all',
'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<script src="//maps.google.com/maps/api/js?key=AIzaSyCyWj7qH1UB7GHF5HAi6OsphBRePFnO0FcwlyTA"></script>
<script src="//cdn.rawgit.com/mahnunchik/markerclustererplus/master/dist/markerclusterer.min.js"></script>
<script src='//cdn.rawgit.com/printercu/google-maps-utility-library-v3-read-only/master/infobox/src/infobox_packed.js' type='text/javascript'></script>
<script src='//underscorejs.org/underscore-min.js' type='text/javascript'></script>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<%= render 'search/form' %>
<div class="container">
<% flash.each do |message_type, message| %>
<%= content_tag(:div, message, class: "alert alert-#message_type") %>
<% end %>
<%= yield %>
<%= render 'layouts/footer' %>
</div>
</body>
</html>
Main Home page
<% if logged_in? %>
<div class="row">
<aside class="col-md-4">
<section class="user_info">
<%= render 'shared/user_info' %>
</section>
<section class="stats">
<%= render 'shared/stats' %>
<%= render 'users/follow_form' if logged_in? %>
</section>
<%= link_to "Create a Business", businesses_new_path, class: "btn btn-lg btn-primary" %>
</aside>
<div class="col-md-8">
<h3>Experience Feed(Businesses) <%= link_to "Users", user_feed_path, class: "btn btn-lg btn-primary" %></h3>
<%= render 'shared/feed' %>
</div>
</div>
<% else %>
<div class="main_message">
<font color=#8c1aff font-weight: "bold" background-color: "purple">Rumordom</font>
</div>
<p>Welcome to Rumordom. This is a website where you can write about an experience you've had with a business. <strong>Every Experience Matters</strong> and someone should know about it. Click <%= link_to "HERE", about_path %> for more information about <font color=#8c1aff size="3em" font-weight: "bold">Rumordom</font>.</p>
<div>
<%= link_to "Sign up now!", signup_path, class: "btn btn-lg btn-primary" %>
<%= link_to "Write about an Experience", new_business_path, class: "btn btn-lg btn-primary" %>
</div>
<% end %>
Search form
<div class="span2">
<div class="search-form" >
<div class="before-buttons", style="font-size:1.2em;">
<%= form_tag search_businesses_path, method: :get do |f| %>
<%= text_field_tag :search, nil, placeholder: "Search for A Business....write about your recent customer experience" %>
<div class="location_search">
<%= text_field_tag :location, nil, placeholder: "denver, miami, etc." %>
</div>
</div>
<div class="buttons">
<%= submit_tag "Search", class: "btn btn-md btn-primary" %>
</div>
<% end %>
</div>
Search Controller
class SearchController < ApplicationController
def search
if params[:term].nil?
@businesses =
else
@businesses = Article.search params[:term]
end
end
end
Main Search Function
def self.search(params)
#businesses = Business.where(category_id: params[:category].to_i)
businesses = Business.where("name like ? or city like ? or state like ?", "%#params[:search]%", "%#params[:search]%", "%#params[:search]%") if params[:search].present?
businesses = businesses.within(20, :origin => "#params[:location]")
businesses = businesses.sort_byx
businesses
end
end
ruby-on-rails google-maps ruby-on-rails-5 geokit
1
What does "doesn't work" mean? you can be more specific: the url doesn't change? content doesn't change? the results are shown empty? what's shown on the server when you do the request? do you see any error? check the browser's inspector Network tab and see if the response of the request makes sense. Also, your search form has two fields namedsearch
andlocation
and your search action uses a param with nameterm
but the actual Article.search receives the params and uses the right keys (are those keys inside aterm
key`?) do you have a view for the search action?
– arieljuod
Nov 10 at 4:33
Nothing at all happens. The server doesn't show any progress at all, it's almost as if I did not press the search button, but if I refresh the page....it works. I just realize though that when i hit refresh and search...it does work, and if i search again on the page it does work...and keeps working. It appears that it is only not working initially when i go to it. Now i do have the search bar load up at the top of every page.....maybe that is related to my problem? Once I refresh and search and it goes to the results...i can keep filling out the form and searching....
– Dan
Nov 11 at 6:10
I'm not sure, but it looks like a case for turbolinks messing things up, try disabling it jsut to be sure. Also, you didn't clarify the names conflict, you fetchparams[:term]
on the action but the form doesn't have theterm
key. I would also try triggering the submit manually from the console withdocument.querySelector('.search-form form').submit()
and see what happens.
– arieljuod
Nov 11 at 15:42
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have an issue where I have a search bar that searches my database via names and location. This does work. However, I have to actually refresh the page most of the time in order for it to work. I've tried placing it in another page, but it seems as if the issue carries over. Any ideas?
Application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Rumordom</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all',
'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<script src="//maps.google.com/maps/api/js?key=AIzaSyCyWj7qH1UB7GHF5HAi6OsphBRePFnO0FcwlyTA"></script>
<script src="//cdn.rawgit.com/mahnunchik/markerclustererplus/master/dist/markerclusterer.min.js"></script>
<script src='//cdn.rawgit.com/printercu/google-maps-utility-library-v3-read-only/master/infobox/src/infobox_packed.js' type='text/javascript'></script>
<script src='//underscorejs.org/underscore-min.js' type='text/javascript'></script>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<%= render 'search/form' %>
<div class="container">
<% flash.each do |message_type, message| %>
<%= content_tag(:div, message, class: "alert alert-#message_type") %>
<% end %>
<%= yield %>
<%= render 'layouts/footer' %>
</div>
</body>
</html>
Main Home page
<% if logged_in? %>
<div class="row">
<aside class="col-md-4">
<section class="user_info">
<%= render 'shared/user_info' %>
</section>
<section class="stats">
<%= render 'shared/stats' %>
<%= render 'users/follow_form' if logged_in? %>
</section>
<%= link_to "Create a Business", businesses_new_path, class: "btn btn-lg btn-primary" %>
</aside>
<div class="col-md-8">
<h3>Experience Feed(Businesses) <%= link_to "Users", user_feed_path, class: "btn btn-lg btn-primary" %></h3>
<%= render 'shared/feed' %>
</div>
</div>
<% else %>
<div class="main_message">
<font color=#8c1aff font-weight: "bold" background-color: "purple">Rumordom</font>
</div>
<p>Welcome to Rumordom. This is a website where you can write about an experience you've had with a business. <strong>Every Experience Matters</strong> and someone should know about it. Click <%= link_to "HERE", about_path %> for more information about <font color=#8c1aff size="3em" font-weight: "bold">Rumordom</font>.</p>
<div>
<%= link_to "Sign up now!", signup_path, class: "btn btn-lg btn-primary" %>
<%= link_to "Write about an Experience", new_business_path, class: "btn btn-lg btn-primary" %>
</div>
<% end %>
Search form
<div class="span2">
<div class="search-form" >
<div class="before-buttons", style="font-size:1.2em;">
<%= form_tag search_businesses_path, method: :get do |f| %>
<%= text_field_tag :search, nil, placeholder: "Search for A Business....write about your recent customer experience" %>
<div class="location_search">
<%= text_field_tag :location, nil, placeholder: "denver, miami, etc." %>
</div>
</div>
<div class="buttons">
<%= submit_tag "Search", class: "btn btn-md btn-primary" %>
</div>
<% end %>
</div>
Search Controller
class SearchController < ApplicationController
def search
if params[:term].nil?
@businesses =
else
@businesses = Article.search params[:term]
end
end
end
Main Search Function
def self.search(params)
#businesses = Business.where(category_id: params[:category].to_i)
businesses = Business.where("name like ? or city like ? or state like ?", "%#params[:search]%", "%#params[:search]%", "%#params[:search]%") if params[:search].present?
businesses = businesses.within(20, :origin => "#params[:location]")
businesses = businesses.sort_byx
businesses
end
end
ruby-on-rails google-maps ruby-on-rails-5 geokit
I have an issue where I have a search bar that searches my database via names and location. This does work. However, I have to actually refresh the page most of the time in order for it to work. I've tried placing it in another page, but it seems as if the issue carries over. Any ideas?
Application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Rumordom</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all',
'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<script src="//maps.google.com/maps/api/js?key=AIzaSyCyWj7qH1UB7GHF5HAi6OsphBRePFnO0FcwlyTA"></script>
<script src="//cdn.rawgit.com/mahnunchik/markerclustererplus/master/dist/markerclusterer.min.js"></script>
<script src='//cdn.rawgit.com/printercu/google-maps-utility-library-v3-read-only/master/infobox/src/infobox_packed.js' type='text/javascript'></script>
<script src='//underscorejs.org/underscore-min.js' type='text/javascript'></script>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<%= render 'search/form' %>
<div class="container">
<% flash.each do |message_type, message| %>
<%= content_tag(:div, message, class: "alert alert-#message_type") %>
<% end %>
<%= yield %>
<%= render 'layouts/footer' %>
</div>
</body>
</html>
Main Home page
<% if logged_in? %>
<div class="row">
<aside class="col-md-4">
<section class="user_info">
<%= render 'shared/user_info' %>
</section>
<section class="stats">
<%= render 'shared/stats' %>
<%= render 'users/follow_form' if logged_in? %>
</section>
<%= link_to "Create a Business", businesses_new_path, class: "btn btn-lg btn-primary" %>
</aside>
<div class="col-md-8">
<h3>Experience Feed(Businesses) <%= link_to "Users", user_feed_path, class: "btn btn-lg btn-primary" %></h3>
<%= render 'shared/feed' %>
</div>
</div>
<% else %>
<div class="main_message">
<font color=#8c1aff font-weight: "bold" background-color: "purple">Rumordom</font>
</div>
<p>Welcome to Rumordom. This is a website where you can write about an experience you've had with a business. <strong>Every Experience Matters</strong> and someone should know about it. Click <%= link_to "HERE", about_path %> for more information about <font color=#8c1aff size="3em" font-weight: "bold">Rumordom</font>.</p>
<div>
<%= link_to "Sign up now!", signup_path, class: "btn btn-lg btn-primary" %>
<%= link_to "Write about an Experience", new_business_path, class: "btn btn-lg btn-primary" %>
</div>
<% end %>
Search form
<div class="span2">
<div class="search-form" >
<div class="before-buttons", style="font-size:1.2em;">
<%= form_tag search_businesses_path, method: :get do |f| %>
<%= text_field_tag :search, nil, placeholder: "Search for A Business....write about your recent customer experience" %>
<div class="location_search">
<%= text_field_tag :location, nil, placeholder: "denver, miami, etc." %>
</div>
</div>
<div class="buttons">
<%= submit_tag "Search", class: "btn btn-md btn-primary" %>
</div>
<% end %>
</div>
Search Controller
class SearchController < ApplicationController
def search
if params[:term].nil?
@businesses =
else
@businesses = Article.search params[:term]
end
end
end
Main Search Function
def self.search(params)
#businesses = Business.where(category_id: params[:category].to_i)
businesses = Business.where("name like ? or city like ? or state like ?", "%#params[:search]%", "%#params[:search]%", "%#params[:search]%") if params[:search].present?
businesses = businesses.within(20, :origin => "#params[:location]")
businesses = businesses.sort_byx
businesses
end
end
ruby-on-rails google-maps ruby-on-rails-5 geokit
ruby-on-rails google-maps ruby-on-rails-5 geokit
asked Nov 10 at 2:57
Dan
112
112
1
What does "doesn't work" mean? you can be more specific: the url doesn't change? content doesn't change? the results are shown empty? what's shown on the server when you do the request? do you see any error? check the browser's inspector Network tab and see if the response of the request makes sense. Also, your search form has two fields namedsearch
andlocation
and your search action uses a param with nameterm
but the actual Article.search receives the params and uses the right keys (are those keys inside aterm
key`?) do you have a view for the search action?
– arieljuod
Nov 10 at 4:33
Nothing at all happens. The server doesn't show any progress at all, it's almost as if I did not press the search button, but if I refresh the page....it works. I just realize though that when i hit refresh and search...it does work, and if i search again on the page it does work...and keeps working. It appears that it is only not working initially when i go to it. Now i do have the search bar load up at the top of every page.....maybe that is related to my problem? Once I refresh and search and it goes to the results...i can keep filling out the form and searching....
– Dan
Nov 11 at 6:10
I'm not sure, but it looks like a case for turbolinks messing things up, try disabling it jsut to be sure. Also, you didn't clarify the names conflict, you fetchparams[:term]
on the action but the form doesn't have theterm
key. I would also try triggering the submit manually from the console withdocument.querySelector('.search-form form').submit()
and see what happens.
– arieljuod
Nov 11 at 15:42
add a comment |
1
What does "doesn't work" mean? you can be more specific: the url doesn't change? content doesn't change? the results are shown empty? what's shown on the server when you do the request? do you see any error? check the browser's inspector Network tab and see if the response of the request makes sense. Also, your search form has two fields namedsearch
andlocation
and your search action uses a param with nameterm
but the actual Article.search receives the params and uses the right keys (are those keys inside aterm
key`?) do you have a view for the search action?
– arieljuod
Nov 10 at 4:33
Nothing at all happens. The server doesn't show any progress at all, it's almost as if I did not press the search button, but if I refresh the page....it works. I just realize though that when i hit refresh and search...it does work, and if i search again on the page it does work...and keeps working. It appears that it is only not working initially when i go to it. Now i do have the search bar load up at the top of every page.....maybe that is related to my problem? Once I refresh and search and it goes to the results...i can keep filling out the form and searching....
– Dan
Nov 11 at 6:10
I'm not sure, but it looks like a case for turbolinks messing things up, try disabling it jsut to be sure. Also, you didn't clarify the names conflict, you fetchparams[:term]
on the action but the form doesn't have theterm
key. I would also try triggering the submit manually from the console withdocument.querySelector('.search-form form').submit()
and see what happens.
– arieljuod
Nov 11 at 15:42
1
1
What does "doesn't work" mean? you can be more specific: the url doesn't change? content doesn't change? the results are shown empty? what's shown on the server when you do the request? do you see any error? check the browser's inspector Network tab and see if the response of the request makes sense. Also, your search form has two fields named
search
and location
and your search action uses a param with name term
but the actual Article.search receives the params and uses the right keys (are those keys inside a term
key`?) do you have a view for the search action?– arieljuod
Nov 10 at 4:33
What does "doesn't work" mean? you can be more specific: the url doesn't change? content doesn't change? the results are shown empty? what's shown on the server when you do the request? do you see any error? check the browser's inspector Network tab and see if the response of the request makes sense. Also, your search form has two fields named
search
and location
and your search action uses a param with name term
but the actual Article.search receives the params and uses the right keys (are those keys inside a term
key`?) do you have a view for the search action?– arieljuod
Nov 10 at 4:33
Nothing at all happens. The server doesn't show any progress at all, it's almost as if I did not press the search button, but if I refresh the page....it works. I just realize though that when i hit refresh and search...it does work, and if i search again on the page it does work...and keeps working. It appears that it is only not working initially when i go to it. Now i do have the search bar load up at the top of every page.....maybe that is related to my problem? Once I refresh and search and it goes to the results...i can keep filling out the form and searching....
– Dan
Nov 11 at 6:10
Nothing at all happens. The server doesn't show any progress at all, it's almost as if I did not press the search button, but if I refresh the page....it works. I just realize though that when i hit refresh and search...it does work, and if i search again on the page it does work...and keeps working. It appears that it is only not working initially when i go to it. Now i do have the search bar load up at the top of every page.....maybe that is related to my problem? Once I refresh and search and it goes to the results...i can keep filling out the form and searching....
– Dan
Nov 11 at 6:10
I'm not sure, but it looks like a case for turbolinks messing things up, try disabling it jsut to be sure. Also, you didn't clarify the names conflict, you fetch
params[:term]
on the action but the form doesn't have the term
key. I would also try triggering the submit manually from the console with document.querySelector('.search-form form').submit()
and see what happens.– arieljuod
Nov 11 at 15:42
I'm not sure, but it looks like a case for turbolinks messing things up, try disabling it jsut to be sure. Also, you didn't clarify the names conflict, you fetch
params[:term]
on the action but the form doesn't have the term
key. I would also try triggering the submit manually from the console with document.querySelector('.search-form form').submit()
and see what happens.– arieljuod
Nov 11 at 15:42
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
ArielJuod was right.
I removed Turbolinks from my application.js, gemfile, and from layouts/application. However I did include this line in the layouts/application file:
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
Now the search bar works right away and the page does not have to be "Refreshed," for it to work. Thanks.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
ArielJuod was right.
I removed Turbolinks from my application.js, gemfile, and from layouts/application. However I did include this line in the layouts/application file:
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
Now the search bar works right away and the page does not have to be "Refreshed," for it to work. Thanks.
add a comment |
up vote
0
down vote
ArielJuod was right.
I removed Turbolinks from my application.js, gemfile, and from layouts/application. However I did include this line in the layouts/application file:
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
Now the search bar works right away and the page does not have to be "Refreshed," for it to work. Thanks.
add a comment |
up vote
0
down vote
up vote
0
down vote
ArielJuod was right.
I removed Turbolinks from my application.js, gemfile, and from layouts/application. However I did include this line in the layouts/application file:
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
Now the search bar works right away and the page does not have to be "Refreshed," for it to work. Thanks.
ArielJuod was right.
I removed Turbolinks from my application.js, gemfile, and from layouts/application. However I did include this line in the layouts/application file:
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
Now the search bar works right away and the page does not have to be "Refreshed," for it to work. Thanks.
answered Nov 15 at 2:53
Dan
112
112
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53235644%2fsearch-bar-does-not-work-unless-i-refresh-the-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
What does "doesn't work" mean? you can be more specific: the url doesn't change? content doesn't change? the results are shown empty? what's shown on the server when you do the request? do you see any error? check the browser's inspector Network tab and see if the response of the request makes sense. Also, your search form has two fields named
search
andlocation
and your search action uses a param with nameterm
but the actual Article.search receives the params and uses the right keys (are those keys inside aterm
key`?) do you have a view for the search action?– arieljuod
Nov 10 at 4:33
Nothing at all happens. The server doesn't show any progress at all, it's almost as if I did not press the search button, but if I refresh the page....it works. I just realize though that when i hit refresh and search...it does work, and if i search again on the page it does work...and keeps working. It appears that it is only not working initially when i go to it. Now i do have the search bar load up at the top of every page.....maybe that is related to my problem? Once I refresh and search and it goes to the results...i can keep filling out the form and searching....
– Dan
Nov 11 at 6:10
I'm not sure, but it looks like a case for turbolinks messing things up, try disabling it jsut to be sure. Also, you didn't clarify the names conflict, you fetch
params[:term]
on the action but the form doesn't have theterm
key. I would also try triggering the submit manually from the console withdocument.querySelector('.search-form form').submit()
and see what happens.– arieljuod
Nov 11 at 15:42