B
B
Befomet2013-12-12 14:33:50
Ruby on Rails
Befomet, 2013-12-12 14:33:50

How to make a tag search filter in Ruby on Rails through the acts_as_taggable_on gem using a checkbox?

Good afternoon, I went through a couple of tutorials and decided to do something of my own, but got stuck on this problem:
The bottom line is to display all the tags in the form of a checkbox on the Search page, and when you click on several tags, a list of all posts containing these tags is displayed.
Everything is standard, so I don’t know what to throw off from the code, and whether it is necessary.
Tags in the URL are separated by commas.
Used ROR 3.2.13
Model

class Post < ActiveRecord::Base
  attr_accessible :tag_list
  acts_as_taggable
end

I would be grateful if one of Sudarei writes in more detail with a code example.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Sidorov, 2013-12-12
@morr

alexmuraro.me/posts/acts-as-taggable-on-a-short-tu...

B
Befomet, 2013-12-12
@Befomet

Either I do not see the essence, or you did not understand the question.
The display of tags in posts is there and all the rules.
I need a filter for all tags in checkboxes, well, something like this, I roughly understand, but I don’t understand how to implement it functionally

<%= form_for(@post) do |f| %>
    <%= f.label :tag_list %>
    <%= f.check_box :tag_list %> #тут скорее всего нужен хеш всех тегов
    <%= f.submit %>
<% end %>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question