acts-as-taggable-on

Rails 5 - Acts as Taggable On gem - simple form collection select for defined tag lists

扶醉桌前 提交于 2020-01-15 03:54:07
问题 I am trying to learn how to use the Acts as Taggable On gem with Rails 5. I use simple form for forms. I think part of the problem arises out of there not being an association on the models between proposal and randd_fields. I have models called Proposal and Randd::Field. I am trying to tag proposals with tags which are the :title attribute of the Randd::Field table. My models have: Proposal class Proposal < ApplicationRecord acts_as_taggable_on :randd_maturities, :randd_fields, :randd

Get all tags on taggable object - no matter context

若如初见. 提交于 2020-01-07 06:28:12
问题 I use acts-as-taggable-on on a collection of photos. I have a general :tags context and an :objectives context that users use for stuff that is in the photo. In the UI I add both tag contexts into the same box. It would be nice if I could get all tags and objectives on one photo in one command, like: photo.gimme_all_tags_no_matter_context #would give me combined list of general tags and objectives. Currently I do this: tags = "#{photo.tags.map{|c| c.name}.join(",")},#{photo.objectives.map{|c|

Get all tags on taggable object - no matter context

牧云@^-^@ 提交于 2020-01-07 06:27:27
问题 I use acts-as-taggable-on on a collection of photos. I have a general :tags context and an :objectives context that users use for stuff that is in the photo. In the UI I add both tag contexts into the same box. It would be nice if I could get all tags and objectives on one photo in one command, like: photo.gimme_all_tags_no_matter_context #would give me combined list of general tags and objectives. Currently I do this: tags = "#{photo.tags.map{|c| c.name}.join(",")},#{photo.objectives.map{|c|

How do I update & display a current user's tags, tagged with acts_as_taggable_on?

巧了我就是萌 提交于 2020-01-06 17:15:30
问题 I'm not sure how to display tags in my view that belong to a user logged in with Omniauth. A page in the view loads a random photos and tags associated to it (via a form that can be updated from that page). It works, but when I log in with Facebook account A, it will show exactly the same tags as if I log in with Facebook account B. Getting the whiny nil error with this below Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id The view is: <%=

How do I update & display a current user's tags, tagged with acts_as_taggable_on?

元气小坏坏 提交于 2020-01-06 17:15:14
问题 I'm not sure how to display tags in my view that belong to a user logged in with Omniauth. A page in the view loads a random photos and tags associated to it (via a form that can be updated from that page). It works, but when I log in with Facebook account A, it will show exactly the same tags as if I log in with Facebook account B. Getting the whiny nil error with this below Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id The view is: <%=

Rails 3 tagging problems, acts_as_taggable_on

僤鯓⒐⒋嵵緔 提交于 2020-01-03 04:18:04
问题 I'm using acts_as_taggable_on to add tags to posts, other tagging plugins/gems don't work with rails 3. I can edit/display tags on the post model and the tags controller displays the posts tagged by name i.e /tags/post-tag-name/. The functionality I want is to turn the tags on the posts pages into links to display the other posts with the same tag. I followed the tutorial in sitepoints 'simply rails 2' which uses acts_as_taggable_on_steroids but I'm stuck with the following error; ActionView:

Update owner tags via form

时光怂恿深爱的人放手 提交于 2019-12-29 06:56:07
问题 I would like to uniquely use owner tags in my app. My problem is that when I create / update a post via a form I only have f.text_field :tag_list which only updates the tags for the post but has no owner. If I use f.text_field :all_tags_list it doesn't know the attribute on create / update. I could add in my controller: User.find(:first).tag( @post, :with => params[:post][:tag_list], :on => :tags ) but then I have duplicate tags, for post and for the owner tags. How can I just work with owner

How can I display all tags from all users for a model instance?

▼魔方 西西 提交于 2019-12-25 08:39:38
问题 I want to get all the tags from all the users in my app for a brand whose ID is 37. The following works but only gets the tags from one of the 2 users currently in the app: <%= BrandUser.last.brand.tags.join(", ") %> The following is my attempt but doesn't work: <%= BrandUser.where(:brand_id => 37).each {|brand| p brand.tags} %> Brand has_many tags, has_many brand_users and has_many users through brand_users User has_many :brand_users and has_many :brands, :through => :brand_users BrandUser

Add N tags to a LOT of objects using acts_as_taggable_on

别说谁变了你拦得住时间么 提交于 2019-12-24 14:50:35
问题 I'm using the acts_as_taggable_on gem on a Rails (Ruby 1.9.3) project. I provide a form to my admins to add 1..n tag(s) to list of resources (let's say clients). I didin't find a way to do this in bulk. Right now I'm looping on every client and add one tag then save the object. This is hurting the server a lot when I'm trying on X thousand clients, eventually creating a timeout. I was wondering if there is a way to apply a tag to an ActiveRecord collection or something. If this is documented

Custom model in rails_admin

旧城冷巷雨未停 提交于 2019-12-24 11:29:43
问题 I have such problem: I'm using rails_admin and gem acts_as_taggable_on. Second have model ActsAsTaggableOn::Tag. And I need to manage it in admin part. Google and StackOverflow don't know answer, or I forgot, how to google =( So, what I tried: Added that in initializers/rails_admin.rb config.model ActsAsTaggableOn::Tag do label 'Тэг' label_plural 'Тэги' configure :name, :string end Still no reaction. But if I try to add config.included_models = [ActsAsTaggableOn::Tag] Then I see that model in