acts-as-taggable-on

Rails 4: text_field for acts_as_taggable_on not separating tags with a comma

▼魔方 西西 提交于 2019-11-30 19:38:39
I am trying to get the text_field in my form partial to comma-separate acts_as_taggable_on tags. Right now, when I reload the page, the commas disappear so if a field has two or more tags, they become one big tag instead. For instance, I get "Tag1 Tag2 Tag3" instead of "Tag1, Tag2, Tag3". I am using acts-as-taggable-on 3.4.2. Here is my _form.html.erb partial: <h2>Tags:</h2> <p>Please separate the tags with a comma ','</p> <% @article.tag_types.each do |tag| %> <div class="form-group"> <strong><%= label_tag tag.to_s.titleize %></strong><br /> <%= f.text_field "#{tag.to_s.singularize}_list".to

Rails acts-as-taggable-on with select2 (and simple_form)

放肆的年华 提交于 2019-11-30 05:09:06
问题 I would like to have a select2 dropdown of tags, where i could select multiple existing tags and add new ones. I have tried many different ways and i either don't get select2 box working or only one value is passed (last one). This is closest i got (passes last value): <%= f.input :tag_list, collection: @model.tags.map { |t| t.name }, input_html: { :style=> 'width: 300px', class: "taggable", data: { placeholder: "Tags" }} %> 回答1: As I mentioned before, normal select2 library now uses only

Rails 4: text_field for acts_as_taggable_on not separating tags with a comma

故事扮演 提交于 2019-11-30 03:53:06
问题 I am trying to get the text_field in my form partial to comma-separate acts_as_taggable_on tags. Right now, when I reload the page, the commas disappear so if a field has two or more tags, they become one big tag instead. For instance, I get "Tag1 Tag2 Tag3" instead of "Tag1, Tag2, Tag3". I am using acts-as-taggable-on 3.4.2. Here is my _form.html.erb partial: <h2>Tags:</h2> <p>Please separate the tags with a comma ','</p> <% @article.tag_types.each do |tag| %> <div class="form-group">

How to apply tags with acts_as_taggable_on using check boxes?

六眼飞鱼酱① 提交于 2019-11-29 23:23:28
I would like to assign two different "types" of tags (sector categories and free tagging) to a Company model using acts_as_taggable_on . NB: I'm new to RoR! This is easy to do if just using standard text input fields, but I would like to use check-boxes on one type (a fixed sector category tag that is predefined), and then allow the user to add comma separated tags in an input field. I have played around with this problem in various ways,... one inspired by this question ...but I cannot get it to work Here is what I have so far: # models/company.rb class Company ... acts_as_taggable_on :tags,

Acts-as-taggable-on find all tags by context

怎甘沉沦 提交于 2019-11-29 06:24:15
问题 So after searching for a tagging gem for my rails app I found the amazing acts-as-taggable gem. Installing it and playing around I discovered that it keeps all the Tags inside a tag db which just holds the Tag.name without the context, instead the context is held in the :through relationship db ( taggings ). For most purposes I can see this being perfect. Except with my app I want to be able to offer the user the ability to tag based on an pre-existing tags ( eg not allow them to create their

How to apply tags with acts_as_taggable_on using check boxes?

爱⌒轻易说出口 提交于 2019-11-28 20:40:51
问题 I would like to assign two different "types" of tags (sector categories and free tagging) to a Company model using acts_as_taggable_on. NB: I'm new to RoR! This is easy to do if just using standard text input fields, but I would like to use check-boxes on one type (a fixed sector category tag that is predefined), and then allow the user to add comma separated tags in an input field. I have played around with this problem in various ways,... one inspired by this question...but I cannot get it

How to use jquery-Tokeninput and Acts-as-taggable-on

允我心安 提交于 2019-11-28 17:19:21
This is how you use autocomplete with jQuery Tokeninput and ActsAsTaggableOn . In my situation i am using a nested form but it shouldnt matter. Everything below is code that works. Code Product Model: attr_accessible :tag_list # i am using the regular :tag_list acts_as_taggable_on :tags # Tagging products Products Controller: #1. Define the tags path #2. Searches ActsAsTaggable::Tag Model look for :name in the created table. #3. it finds the tags.json path and whats on my form. #4. it is detecting the attribute which is :name for your tags. def tags @tags = ActsAsTaggableOn::Tag.where("tags

Creating url slugs for tags with acts_as_taggable_on

北慕城南 提交于 2019-11-27 18:53:27
I would like to create url slugs for tags managed by the acts_as_taggable_on gem. For instance instead of urls like http://myapp.com/tags/5 , I would like to have http://myapp.com/tags/my-tag (where 'my tag' is the tag's unique name). In models that I create myself I usually do this by overriding the model's to_param method, and creating a "slug" field in the model to save the result of the new to_param method. I tried doing this with the Tag model of ActsAsTaggableOn, but it is not working. I can otherwise override things in the tag.rb class of ActsAsTaggableOn as follows: # Overwrite tag

How to use jquery-Tokeninput and Acts-as-taggable-on

泪湿孤枕 提交于 2019-11-27 10:35:44
问题 This is how you use autocomplete with jQuery Tokeninput and ActsAsTaggableOn. In my situation i am using a nested form but it shouldnt matter. Everything below is code that works. Code Product Model: attr_accessible :tag_list # i am using the regular :tag_list acts_as_taggable_on :tags # Tagging products Products Controller: #1. Define the tags path #2. Searches ActsAsTaggable::Tag Model look for :name in the created table. #3. it finds the tags.json path and whats on my form. #4. it is

Creating url slugs for tags with acts_as_taggable_on

丶灬走出姿态 提交于 2019-11-26 19:38:48
问题 I would like to create url slugs for tags managed by the acts_as_taggable_on gem. For instance instead of urls like http://myapp.com/tags/5, I would like to have http://myapp.com/tags/my-tag (where 'my tag' is the tag's unique name). In models that I create myself I usually do this by overriding the model's to_param method, and creating a "slug" field in the model to save the result of the new to_param method. I tried doing this with the Tag model of ActsAsTaggableOn, but it is not working. I