Created a search function with rails5.
It is created with form_tag, and when searching, the result is displayed on a separate page.
Therefore, get the characters entered by the user on the search result page,
Example: "Search results for (entered characters)"
If i do<% =: search%>, it will be displayed as it is like "search search results".
<% = form_tag (search_posts_path,: method =>"get") do%> <% = text_field_tag: search, '', class: "application-text", placeholder: "Looking for something?"%> <% = button_tag type: "submit",: name =>nil, class: "search-btn" do%> <i></i> <% end%> <% end%>
Search function part controller
def search @posts = Post.all.search (params [: search]) end
Answer # 1
<% = params [: search]%>
- ruby on rails - i want to display activehash in the view file with the corresponding character instead of id
- ruby on rails - i want to display a list of liked data
- ruby - i want to display specific columns in rails in descending order of numbers
- ruby on rails - i want to display the details page
- ruby on rails - [rails6] i want to display the validation error generated by update by index
- ruby - rails comment function display
- ruby on rails - i want to display the number of people in the group
- [ruby on rails] i want to display a parent model that matches the information of the associated child model
- ruby on rails - i want to display all the images in the [rails] directory in the browser!
- ruby on rails - [rails] about the display position after redirect by pressing like
- ruby on rails 5 - i want to display ruby on rails error messages using a modal window
- ruby - rails pagination function i want to display in alphabetical order
- ruby - [rails] i want to be able to enter only double-byte characters including symbols in validation
- ruby on rails - [rails] how to round (omission and display) the character string of link_to
- ruby on rails - i want to display search results
- ruby on rails 6 - i want to change the display of the product detail page according to the user's conditions
- ruby on rails - [rails beginner] i want to display the posted content on my page
- ruby on rails - i want to display the latest posting date and time by creating a simple bulletin board
- ruby on rails - i want to display the posted image in the background using image_tag or url_for
- ruby - dynamically display rails select box choices
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- python - you may need to restart the kernel to use updated packages error
- python 3x - typeerror: 'method' object is not subscriptable
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- xcode - pod install [!] no `podfile 'found in the project directory
- vuejs - [vuetify] unable to locate target [data-app] i want to unit test to avoid warning
- android studio - unresolved reference comes out in kotlin