为标记集成到RailsAdmin

为标记集成到RailsAdmin

是否有人将行为作为标记集成到RailsAdmin?我正在尝试rails_admin_tag_list,但对我不起作用。

我的环境:

**Gems included by the bundle:
  * actionmailer (3.2.13)
  * actionpack (3.2.13)
  * activemodel (3.2.13)
  * activerecord (3.2.13)
  * activeresource (3.2.13)
  * activesupport (3.2.13)
  * acts-as-taggable-on (2.3.3)
  * acts_as_votable (0.4.0)
  * addressable (2.3.3)
  * arel (3.0.2)
  * bcrypt-ruby (3.0.1)
  * best_in_place (2.1.0)
  * better_errors (0.6.0)
  * bootstrap-sass (2.3.1.0)
  * bootstrap-wysihtml5-rails (0.3.1.19)
  * builder (3.0.4)
  * bundler (1.3.2)
  * cache_digests (0.2.0)
  * cancan (1.6.9)
  * coderay (1.0.9)
  * coffee-rails (3.2.2)
  * coffee-script (2.2.0)
  * coffee-script-source (1.6.2)
  * daemons (1.1.9)
  * database_cleaner (0.9.1)
  * delayed_job (3.0.5)
  * delayed_job_active_record (0.3.3)
  * devise (2.2.3)
  * diff-lcs (1.1.3)
  * erubis (2.7.0)
  * execjs (1.4.0)
  * fabrication (2.6.1)
  * faraday (0.8.7)
  * ffaker (1.15.0)
  * font-awesome-sass-rails (3.0.2.2)
  * haml (4.0.1)
  * hashie (1.2.0)
  * hike (1.2.1)
  * httpauth (0.2.0)
  * i18n (0.6.1)
  * journey (1.0.4)
  * jquery-rails (2.2.1)
  * jquery-ui-rails (3.0.1)
  * json (1.7.7)
  * jwt (0.1.8)
  * kaminari (0.14.1)
  * kgio (2.8.0)
  * koala (1.6.0)
  * mail (2.5.3)
  * mime-types (1.21)
  * multi_json (1.7.2)
  * multipart-post (1.2.0)
  * nested_form (0.3.1)
  * nokogiri (1.5.9)
  * oauth2 (0.8.1)
  * omniauth (1.1.3)
  * omniauth-facebook (1.4.1)
  * omniauth-oauth2 (1.1.1)
  * orm_adapter (0.4.0)
  * pg (0.14.1)
  * polyglot (0.3.3)
  * rack (1.4.5)
  * rack-cache (1.2)
  * rack-pjax (0.7.0)
  * rack-ssl (1.3.3)
  * rack-test (0.6.2)
  * rails (3.2.13)
  * rails_admin (0.4.6)
  * rails_admin_tag_list (0.1.5)
  * railties (3.2.13)
  * raindrops (0.10.0)
  * rake (10.0.4)
  * rdoc (3.12.2)
  * remotipart (1.0.5)
  * rspec-core (2.12.2)
  * rspec-expectations (2.12.1)
  * rspec-mocks (2.12.2)
  * rspec-rails (2.12.2)
  * safe_yaml (0.9.0)
  * sass (3.2.7)
  * sass-rails (3.2.6)
  * simplecov (0.7.1)
  * simplecov-html (0.7.1)
  * sprockets (2.2.2)
  * strong_parameters (0.2.0)
  * thor (0.18.0)
  * tilt (1.3.6)
  * treetop (1.4.12)
  * tzinfo (0.3.37)
  * uglifier (1.3.0)
  * unicorn (4.6.2)
  * warden (1.2.1)

最佳答案

假设您有模特儿,

class Post < ActiveRecord::Base
  attr_accessible :title, :user_id, :content, :tag_list

  acts_as_taggable
end

并在rails_admin.rb中的初始值设定项下
config.model Post do
  list do
    field :title
    field :tag_list
  end

  edit do
    field :title
    field :tag_list do
      html_attributes do
        {:style => "width:90%"}
      end
    end
    field :content
  end
end

就是这样,这是一个包含上述场景的示例项目:

https://github.com/railscash/sample_change_user_role

关于ruby-on-rails - 如何将可行为标记集成到RailsAdmin?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15652085/

10-10 05:12