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

rails 5.2 api-only环境下,引起view不渲染 #227

Closed
lehug opened this issue May 3, 2018 · 2 comments
Closed

rails 5.2 api-only环境下,引起view不渲染 #227

lehug opened this issue May 3, 2018 · 2 comments

Comments

@lehug
Copy link

lehug commented May 3, 2018

rails 5.2 api-only环境下,增加此gem包,则view的jbuilder不渲染。暂未深层次分析,先抛出这个问题反馈下。试了老版本,因为依赖active_support = 5.2,所以太老的用不了,支持到5.2的版本中,均有问题。
附上gemfile.lock文件

GIT
  remote: https://github.com/diandanbao/carrierwave-aliyun.git
  revision: f8bfa6f74e2081a84b3ec1d0efc29da50390138a
  specs:
    carrierwave-aliyun (0.9.9)
      aliyun-oss-sdk (>= 0.1.6)
      carrierwave (>= 0.5.7)

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (5.2.0)
      actionpack (= 5.2.0)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailer (5.2.0)
      actionpack (= 5.2.0)
      actionview (= 5.2.0)
      activejob (= 5.2.0)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.2.0)
      actionview (= 5.2.0)
      activesupport (= 5.2.0)
      rack (~> 2.0)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.2.0)
      activesupport (= 5.2.0)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (5.2.0)
      activesupport (= 5.2.0)
      globalid (>= 0.3.6)
    activemodel (5.2.0)
      activesupport (= 5.2.0)
    activerecord (5.2.0)
      activemodel (= 5.2.0)
      activesupport (= 5.2.0)
      arel (>= 9.0)
    activestorage (5.2.0)
      actionpack (= 5.2.0)
      activerecord (= 5.2.0)
      marcel (~> 0.3.1)
    activesupport (5.2.0)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    acts_as_list (0.9.12)
      activerecord (>= 3.0)
    addressable (2.5.2)
      public_suffix (>= 2.0.2, < 4.0)
    aliyun-oss-sdk (0.1.8)
      addressable
      gyoku
      httparty
    arel (9.0.0)
    ast (2.4.0)
    awesome_nested_set (3.1.4)
      activerecord (>= 4.0.0, < 5.3)
    bcrypt (3.1.11)
    bootsnap (1.3.0)
      msgpack (~> 1.0)
    builder (3.2.3)
    byebug (10.0.2)
    carrierwave (1.2.2)
      activemodel (>= 4.0.0)
      activesupport (>= 4.0.0)
      mime-types (>= 1.16)
    chinese_pinyin (1.0.1)
    concurrent-ruby (1.0.5)
    crass (1.0.4)
    diff-lcs (1.3)
    domain_name (0.5.20180417)
      unf (>= 0.0.5, < 1.0.0)
    erubi (1.7.1)
    ffi (1.9.23)
    globalid (0.4.1)
      activesupport (>= 4.2.0)
    gyoku (1.3.1)
      builder (>= 2.1.2)
    http (3.3.0)
      addressable (~> 2.3)
      http-cookie (~> 1.0)
      http-form_data (~> 2.0)
      http_parser.rb (~> 0.6.0)
    http-cookie (1.0.3)
      domain_name (~> 0.5)
    http-form_data (2.1.0)
    http_parser.rb (0.6.0)
    httparty (0.16.2)
      multi_xml (>= 0.5.2)
    i18n (1.0.1)
      concurrent-ruby (~> 1.0)
    jbuilder (2.7.0)
      activesupport (>= 4.2.0)
      multi_json (>= 1.2)
    jwt (2.1.0)
    kaminari (1.1.1)
      activesupport (>= 4.1.0)
      kaminari-actionview (= 1.1.1)
      kaminari-activerecord (= 1.1.1)
      kaminari-core (= 1.1.1)
    kaminari-actionview (1.1.1)
      actionview
      kaminari-core (= 1.1.1)
    kaminari-activerecord (1.1.1)
      activerecord
      kaminari-core (= 1.1.1)
    kaminari-core (1.1.1)
    listen (3.1.5)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
      ruby_dep (~> 1.2)
    loofah (2.2.2)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.0)
      mini_mime (>= 0.1.1)
    marcel (0.3.2)
      mimemagic (~> 0.3.2)
    method_source (0.9.0)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mimemagic (0.3.2)
    mini_mime (1.0.0)
    mini_portile2 (2.3.0)
    minitest (5.11.3)
    msgpack (1.2.4)
    multi_json (1.13.1)
    multi_xml (0.6.0)
    nio4r (2.3.1)
    nokogiri (1.8.2)
      mini_portile2 (~> 2.3.0)
    parallel (1.12.1)
    paranoia (2.4.1)
      activerecord (>= 4.0, < 5.3)
    parser (2.5.1.0)
      ast (~> 2.4.0)
    pg (1.0.0)
    polyamorous (1.3.3)
      activerecord (>= 3.0)
    powerpack (0.1.1)
    public_suffix (3.0.2)
    puma (3.11.4)
    rack (2.0.5)
    rack-cors (1.0.2)
    rack-test (1.0.0)
      rack (>= 1.0, < 3)
    rails (5.2.0)
      actioncable (= 5.2.0)
      actionmailer (= 5.2.0)
      actionpack (= 5.2.0)
      actionview (= 5.2.0)
      activejob (= 5.2.0)
      activemodel (= 5.2.0)
      activerecord (= 5.2.0)
      activestorage (= 5.2.0)
      activesupport (= 5.2.0)
      bundler (>= 1.3.0)
      railties (= 5.2.0)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.0.4)
      loofah (~> 2.2, >= 2.2.2)
    railties (5.2.0)
      actionpack (= 5.2.0)
      activesupport (= 5.2.0)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rainbow (3.0.0)
    rake (12.3.1)
    ransack (1.8.8)
      actionpack (>= 3.0)
      activerecord (>= 3.0)
      activesupport (>= 3.0)
      i18n
      polyamorous (~> 1.3.2)
    rb-fsevent (0.10.3)
    rb-inotify (0.9.10)
      ffi (>= 0.5.0, < 2)
    rspec-core (3.7.1)
      rspec-support (~> 3.7.0)
    rspec-expectations (3.7.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.7.0)
    rspec-mocks (3.7.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.7.0)
    rspec-rails (3.7.2)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 3.7.0)
      rspec-expectations (~> 3.7.0)
      rspec-mocks (~> 3.7.0)
      rspec-support (~> 3.7.0)
    rspec-support (3.7.1)
    rubocop (0.55.0)
      parallel (~> 1.10)
      parser (>= 2.5)
      powerpack (~> 0.1)
      rainbow (>= 2.2.2, < 4.0)
      ruby-progressbar (~> 1.7)
      unicode-display_width (~> 1.0, >= 1.0.1)
    ruby-progressbar (1.9.0)
    ruby_dep (1.5.0)
    spring (2.0.2)
      activesupport (>= 4.2)
    spring-watcher-listen (2.0.1)
      listen (>= 2.7, < 4.0)
      spring (>= 1.2, < 3.0)
    sprockets (3.7.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.1)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    swagger-blocks (2.0.2)
    thor (0.20.0)
    thread_safe (0.3.6)
    tzinfo (1.2.5)
      thread_safe (~> 0.1)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.5)
    unicode-display_width (1.3.2)
    websocket-driver (0.7.0)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.3)
    wechat (0.9.0)
      activesupport (>= 3.2, <= 5.2)
      http (>= 1.0.4, < 4)
      nokogiri (>= 1.6.0)
      thor

PLATFORMS
  ruby

DEPENDENCIES
  acts_as_list
  awesome_nested_set
  bcrypt (~> 3.1.7)
  bootsnap (>= 1.1.0)
  byebug
  carrierwave
  carrierwave-aliyun!
  chinese_pinyin
  jbuilder (~> 2.5)
  jwt
  kaminari
  listen (>= 3.0.5, < 3.2)
  paranoia
  pg (>= 0.18, < 2.0)
  puma (~> 3.11)
  rack-cors
  rails (~> 5.2.0)
  ransack
  rspec-rails
  rubocop
  spring
  spring-watcher-listen (~> 2.0.0)
  swagger-blocks
  tzinfo-data
  wechat

RUBY VERSION
   ruby 2.4.1p111

BUNDLED WITH
   1.16.1

@Eric-Guo
Copy link
Owner

Eric-Guo commented May 3, 2018

165的这个解决方案可用?

@lehug
Copy link
Author

lehug commented May 3, 2018

@Eric-Guo 按照上面链接的方案,解决了,谢谢

class ApplicationController < ActionController::API
  include ActionView::Rendering

  def render_to_body(options)
    _render_to_body_with_renderer(options) || super
  end
end

@lehug lehug closed this as completed May 3, 2018
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