Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acts_as_taggable not populating :tag_list field #3015

Closed
howells opened this issue Mar 21, 2014 · 5 comments
Closed

acts_as_taggable not populating :tag_list field #3015

howells opened this issue Mar 21, 2014 · 5 comments

Comments

@howells
Copy link

howells commented Mar 21, 2014

acts_as_taggable seems to be working correctly everywhere else but activeadmin, and confusingly does work for other models but not one called "PartnerBenefit". So it can only be an ActiveAdmin bug, or something dumb I'm doing wrong.

When words separated by commas are entered into the tag_list field they are parsed and saved successfully, but when I return to edit the PartnerBenefit, the tag_list field is blank (and so saving again just removes the tag associations).

In my aa file:

# form
    form :html => { :enctype => "multipart/form-data" } do |f|
        f.inputs do
            f.input :name
            f.input :title
            f.input :tag_list
            f.input :thumbnail, :as => :attachment, :required => false,
                :image => proc { |o| o.thumbnail.url(:main) if o.thumbnail.present? }
            f.input :header_image, :as => :attachment, :required => false,
                :image => proc { |o| o.header_image.url(:main) if o.header_image.present? }
            f.input :description, :as => :ckeditor
            f.input :details, :as => :ckeditor, :hint => "Shown only to super members"
            f.input :position
        end
        f.actions
    end

IN my model:

class PartnerBenefit < ActiveRecord::Base

    attr_accessible :description, :name, :position, :thumbnail, :title, :details, :header_image, :summary, :tag_list

    acts_as_list

    default_scope order("position")

    has_attached_file :thumbnail,
            :styles => { :main => '220x226#' }
    do_not_validate_attachment_file_type :thumbnail

    has_attached_file :header_image, :styles => { :thumbnail => '100x100#', :main => ['700x315#', :jpg] }
    do_not_validate_attachment_file_type :header_image

    acts_as_taggable

    def to_s
        title
    end

    def to_param
        "#{id} #{name}".parameterize
    end

end

Any ideas?

@timoschilling
Copy link
Member

please do this in your active admin resource:

controller do
  def update
    super
    puts @partner_benefit.inspect
    puts params
  end
end

@timoschilling
Copy link
Member

I’m going to close this since you haven’t responded. Please feel free to update this issue with additional information so it can be reconsidered.

@howells
Copy link
Author

howells commented Feb 27, 2015

Sorry for the epic delay on this - I added that in but what should I expect to see?

@timoschilling
Copy link
Member

After 2 month, I don't know why I ask that. Please Post that result and I reopen the issue and take a look on it.

@howells
Copy link
Author

howells commented Mar 2, 2015

It seems that the tags are committed correctly on update, and if I just use

f.input :tags

a multiple select box with the correct tags is shown; it's just the tag_list method that seems to be blank

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants