Home>
What i am doing is almost the same as this page.I want to create individual links with ransack
I am making a search function with ransack, and I want to jump to the search result when I click the div containing the image and text.
shops_controller
def index
@q = Shop.ransack (params [: q])
@shops = @ q.result (distinct: true) .paginate (page: params [: page])
end
view
<% = link_to controller: "shops", action: "index", q: {address_cont:'Tokyo'}, class: "Class I want to reflect" do%>
image
text
<% end%>
When I click the image and text div surrounded by link_to, it jumps to the search result of "Tokyo" properly, but the class is not reflected and css does not work.
I think the grammar of link_to is wrong, but please teach me how to write it correctly.
-
Answer # 1
Related articles
- ruby on rails - [rails] i want to pass json from controller to html (erb)
- ruby on rails - i want to move to the product purchase page
- ruby on rails - i want to launch rails with a new file
- ruby on rails - i want to sort the search results
- ruby on rails - i want to save the purchase information in the db
- ruby - [rails] the class attribute specified by the div tag enclosed in simple_format is not applied
- ruby on rails - i want to erase www on heroku
- ruby - i want to use two rails renders
- ruby on rails - i want to eliminate nomethoderror
- ruby on rails - i want to deploy to aws ec2 server
- ruby on rails - i want to display "sold out" when the product is sold
- i want to have data for each prefecture with ruby on rails
- ruby on rails - i want to display the details page
- ruby on rails - i want to set responsestatus to 200, but it becomes 401
- ruby on rails 6 - i want to save data from one form to multiple tables at the same time
- ruby on rails - i want to save data in an intermediate table
- ruby on rails - i want to display a list of liked data
- ruby on rails - i can't log in to the app in the production environment (the app that was successfully deployed on heroku)
- ruby on rails - rails: the combination of devise and simple_form makes the user registration form, and the username value become
Trends
- python - you may need to restart the kernel to use updated packages error
- 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
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- javascript - how to check if an element exists in puppeteer
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to call a child component method from a parent in vuejs
- python 3x - typeerror: 'method' object is not subscriptable
It is grammatically valid, but if it is left as it is
class
AlsoPart of the URLWill be incorporated into.Let's separate the hash for the URL and the other.