acts-as-taggable-on

select2 rails form sends nothing

此生再无相见时 提交于 2019-12-12 05:49:06
问题 I'm stacked. I'm using select2 and acts_as_taggable to tag my order model. Here is a code <div class="field"> <%= f.label :tag_list, "TAGS" %><br> <%= f.select :tag_list, options_for_select([['Human', 'Hs'], ['Mouse', 'Mm'], ['Yeast', 'Sc']]),{},:multiple => true, :class =>"category" %> </div> And also script: <script> $(document).ready(function() {$(".category").select2(); }); </script> All works fine without connecting script ( with select2) but if with, it looks like working good but it

Tagging from Scratch: the Querying Database issue

霸气de小男生 提交于 2019-12-12 04:33:59
问题 @saverio was successful on answer this database query question on Tagging from Scratch: the Tag Cloud Issue Now I'm trying to connect the tagging system with the jQuery-tokenInput to Create and Find tags dynamically as on http://railscasts.com/episodes/258-token-fields-revised. My guess is that is a Query problem to the Posgresql Database. I've got Postgresql correctly installed jQuery-tokenInput is on its place on Application.js //= require jquery.tokeninput Somehow it can load the tags from

Does the :any flag overwrites the :on (context) flag in acts_as_taggable_on's tagged_with?

僤鯓⒐⒋嵵緔 提交于 2019-12-12 04:15:42
问题 I'm confused with how the flags :on and :any works together in the "tagged_with" method of acts_as_taggable_on. For example, if I have the following users @user1 and @user2: class User < ActiveRecord::Base acts_as_taggable_on :skills, :interests end @user1 = User.new(:name => "Bobby") @user1.interest_list = "1, 15" @user1.skill_list = "2, 17" @user1.save @user2 = User.new(:name => "Al") @user2.interest_list = "3, 10" @user2.skill_list = "4, 6" @user2.save When I want to get all users who's

Rails display related posts by tags with images from carrierwave

為{幸葍}努か 提交于 2019-12-12 04:07:49
问题 postI'm trying to retrieve related posts by tags by showing the attached image per related post, uploaded by using the carrierwave gem Tags were written from scratch but similar to acts-as-taggable-on gem . Below solution picked from Rails count article per tag and related article by tag displays the related posts by title. <% @posts.each do |post| %> <% post.tags.each do |tag| %> RELATED POSTS: <% tag.posts.each do |related_post| %> <%= link_to related_post.title + " , ", post %> <% end %> <

How can a rails form be filtered to show only objects without tags, and by a current user?

喜欢而已 提交于 2019-12-12 00:53:33
问题 I'm using acts_as_taggable_on and tags are associated to a Brand model. Users, via a User model, then add tags to each brand via a form partial. The problem is that the form partial (in an update method in the controller), shows all the tags specific to the brand instance, instead of showing only the ones that are tagged by the current user's tagger_id. The second part to this is that I want the form to only show brand instances that have no tags by the current user yet. I have defined the

how add tag model (ActsAsTaggableOn) in rails_admin?

倖福魔咒の 提交于 2019-12-11 07:53:50
问题 I install rails admin and include all model in active record in rails admin, first time, when install rails admin display me this error NoMethodError in RailsAdmin::MainController#index undefined method `per_page_kaminari' for #<ActiveRecord::Relation:0x00000006713e18> and fixed it by added this configure Kaminari.configure do |config| config.page_method_name = :per_page_kaminari end when install acts_as_taggable_on gem in project, rails admin did't add tag model in it ( i added field tags

How to display a tag cloud from Acts as Taggable On on an index page in Ruby on Rails 3.2.7?

五迷三道 提交于 2019-12-11 04:58:06
问题 I'm very new to Ruby on Rails, so there's probably a simple solution I'm missing. The tldr version - how do I display an Acts As Taggable On tag cloud of distinct (i.e. no repeating) tags assigned to all instances of a particular model on that model's index page? The longer version - I have a model called Video in which I have successfully managed to implement a tagging feature using Acts as Taggable On and this fantastic tutorial. What I'd like to do now is, on the Video's index page (index

Optimizing queries with acts_as_taggable_on

微笑、不失礼 提交于 2019-12-11 04:04:27
问题 Using Rails 3.1 and gem 'acts-as-taggable-on' version 2.1.1. I have a class: class Meal < ActiveRecord::Base acts_as_taggable_on :foods ... end I have several different scopes on Meal that I use on a dashboard-type page. In the controller, I call, for example: def index @today = Meal.from_today @yesterday = Meal.from_yesterday end I iterate over @today and @yesterday separately on the dashboard page. I'd like to optimize the database calls. Right now, I call <%= meal.food_list %> in the view

How to accept comma-delimited list to build tags for model?

不想你离开。 提交于 2019-12-11 00:42:16
问题 I'm switching off of acts_as_taggable_on because of limited flexibility for my current application. Instead, I'm building my tags from scratch as their own model. However, I already miss the "@model.tag_list" method for forms, that would split up comma-delimited user input and make individual tags. My "taggable" model is a video, and I'm curious how to write a method that can essentially act like the "tag_list"? Example: <%= form_for @video do %> <%= f.text_field :tag_list %> .... Given the

In rails 4, how can I manipulate strong parameters before creation?

我是研究僧i 提交于 2019-12-11 00:38:02
问题 I am trying to convert an array inputed from a form multiple select field into a string separating the elements with commas. The gem i am using requires a tag_field in the form of a string separated by commas, but my multiple select field creates an array. Strong parameters reject the array so I need to convert the array to a string. Here is the code I have now in my application controller, but it is not working. def configure_devise_params devise_parameter_sanitizer.for(:sign_up) do |u| u[