[[+content_image]]
D
D
dexdev2014-10-15 16:42:11
Ruby on Rails
dexdev, 2014-10-15 16:42:11

How to request parameters from a link in rails?

There is a form

<%= form_tag category_posts_path, :method => 'get' do |f| %>
        <%= select_tag(:city_id, options_for_select([['Москва', 1], ['Питер', 2], ['Казань', 3]], {selected: params[:city_id]}),prompt: "Выбрать город",class: "form-control", :onchange => "this.form.submit();") %>
<% end %>

How to do the same but using link_to or button_to?
I tried to do this but it didn't work
<%= button_to ':city_id',category_posts_path(2), :method=>:get %>

It is necessary that by clicking on the links all posts with a certain city get out

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
D
Dmitry, 2014-10-16
@deemytch

google: rails link_to remote

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question