My Rails操作在传输相同数量的数据后停止呈现响应。没有显示错误或警告。
起初,我认为我的部分可能是原因,但后来我删除了部分调用并插入了一些纯文本,结果html仍然被切断,具体取决于我插入了多少文本。
我使用thin
,webrick
和pow
+ nginx
进行了尝试。
看起来它在某处有某种响应大小限制。有什么想法吗?
更新
渲染在特定代码上失败(即使我清空_offer
部分):
# Controller:
@offers = Offer.all
# View:
<% offers.each do |offer| %>
<%= render offer %>
<% end %>
# views/offers/_offer.html.haml
%li{ :class => offer.promo_type }
.content_card
.content_item_wrapper
.exclusive_content_ribbon
.exlusive_glossy
.exclusive_operator
.operator_icon
.exclusive_content_photo= image_tag offer.package.hotel.main_image_path
.exclusive_content_hotel
.ex_hotel_stars
%span{ :class => ["ex_hotel_stars_b", "star_#{offer.package.hotel.stars}"] }
.ex_hotel_name
%a= offer.package.hotel.name
.ex_hotel_place
%span.ex_hotel_place_country= offer.package.hotel.country.name_ru
›
%span.ex_hotel_place_region= offer.package.hotel.city.name_ru
更新2:
如果删除.exclusive_content_photo= image_tag offer.package.hotel.main_image_path
下面的所有内容(包括此行)
更新3:
对offer.package
的任何调用都会导致崩溃。在控制台中一切正常。
======
我的宝石清单:
Gems included by the bundle: * aasm (3.0.14) * actionmailer (3.2.9) * actionpack (3.2.9) * activeadmin (0.5.0 eea827a) * activemodel (3.2.9) * activerecord (3.2.9) * activeresource (3.2.9) * activesupport (3.2.9) * addressable (2.3.2) * ansi (1.4.3) * arbre (1.0.1) * arel (3.0.2) * aws-sdk (1.7.1) * bcrypt-ruby (3.0.1) * bourbon (2.1.2) * builder (3.0.4) * bullet (4.2.0 c292bb7) * bundler (1.2.1) * cancan (1.6.8) * capistrano (2.13.5) * capybara (1.1.3) * celluloid (0.12.3) * childprocess (0.3.6) * chronic (0.8.0) * clickatell (0.8.2 62d215c) * coderay (1.0.8) * coffee-rails (3.2.2) * coffee-script (2.2.0) * coffee-script-source (1.4.0) * connection_pool (0.9.2) * css_parser (1.2.6) * daemons (1.1.9) * devise (2.1.2) * diff-lcs (1.1.3) * domain_name (0.5.4) * erubis (2.7.0) * eventmachine (1.0.0) * exception_notification (3.0.0) * execjs (1.4.0) * facter (1.6.14) * factory_girl (4.1.0) * factory_girl_rails (4.1.0) * fancybox-rails (0.1.4) * faraday (0.8.4) * faraday_middleware (0.9.0) * fastercsv (1.5.5) * faye-websocket (0.4.6) * ffi (1.2.0) * formtastic (2.2.1) * god (0.13.1) * guard (1.5.4) * guard-rspec (2.1.2) * haml (3.1.7) * has_scope (0.5.1) * hashie (1.2.0) * highline (1.6.15) * hike (1.2.1) * http_parser.rb (0.5.3) * httparty (0.9.0) * i18n (0.6.1) * inherited_resources (1.3.1) * jbuilder (0.8.2) * journey (1.0.4) * jquery-rails (2.1.3) * json (1.7.5) * kaminari (0.14.1) * kgio (2.7.4) * launchy (2.1.2) * letter_opener (1.0.0) * libv8 (3.3.10.4) * libwebsocket (0.1.6.1) * libxml-ruby (2.3.3) * listen (0.5.3) * lumberjack (1.0.2) * mail (2.4.4) * markerb (1.0.0) * mechanize (2.5.1) * meta_search (1.1.3) * method_source (0.8.1) * mime-types (1.19) * mini_magick (3.4) * multi_json (1.3.7) * multi_xml (0.5.1) * multipart-post (1.1.5) * mysql2 (0.3.11) * net-http-digest_auth (1.2.1) * net-http-persistent (2.8) * net-scp (1.0.4) * net-sftp (2.0.5) * net-ssh (2.6.1) * net-ssh-gateway (1.1.0) * newrelic_rpm (3.5.2.17) * nokogiri (1.5.5) * ntlm-http (0.1.1) * orm_adapter (0.4.0) * poltergeist (1.0.2) * polyamorous (0.5.0) * polyglot (0.3.3) * pry (0.9.10) * rack (1.4.1) * rack-cache (1.2) * rack-protection (1.2.0) * rack-ssl (1.3.2) * rack-test (0.6.2) * rails (3.2.9) * railties (3.2.9) * raindrops (0.10.0) * rake (10.0.2) * rb-fsevent (0.9.2) * rdoc (3.12) * redcarpet (2.2.2) * redis (3.0.2) * redis-actionpack (3.2.3) * redis-activesupport (3.2.3) * redis-namespace (1.2.1) * redis-rack (1.4.2) * redis-rails (3.2.3) * redis-store (1.1.3) * responders (0.9.3) * roadie (2.3.4) * rspec (2.12.0) * rspec-core (2.12.0) * rspec-expectations (2.12.0) * rspec-mocks (2.12.0) * rspec-nc (0.0.4) * rspec-rails (2.12.0) * rubyzip (0.9.9) * russian (0.6.0) * sass (3.2.3) * sass-rails (3.2.5) * sax-machine (0.1.0) * selenium-webdriver (2.26.0) * sendgrid (1.1.0) * sidekiq (2.5.3) * simple_oauth (0.1.9) * sinatra (1.3.3) * slim (1.3.4) * slop (3.3.3) * sprockets (2.2.1) * subexec (0.2.2) * temple (0.5.5) * terminal-notifier (1.4.2) * therubyracer (0.10.2) * thin (1.5.0) * thor (0.16.0) * tilt (1.3.3) * timers (1.0.1) * tinder (1.9.1) * treetop (1.4.12) * turbo-sprockets-rails3 (0.3.2) * turn (0.9.6) * twitter-stream (0.1.16) * typhoeus (0.4.2) * tzinfo (0.3.35) * uglifier (1.3.0) * unf (0.0.5) * unf_ext (0.0.5) * unicorn (4.4.0) * uniform_notifier (1.1.0) * uuidtools (2.1.3) * warden (1.2.1) * webrobots (0.0.13) * websocket (1.0.3) * whenever (0.8.0) * xpath (0.1.4) * yaml_db (0.2.3)
答案 0 :(得分:1)
子弹宝石就是它的原因。有关详细信息,请参阅https://github.com/rails/rails/issues/8283
答案 1 :(得分:0)
您似乎在视图中使用“优惠”而非“@offers”。除此之外,我遇到了HAML在视图中由Ruby代码引起的错误消息问题。您确定控制器返回的对象是否包含视图使用的所有数据?在您获取优惠后的控制器中尝试输入
puts @offers.inspect
并查看您的服务器日志以查看此对象具有您期望的信息