我在Rails 3.2中有一个可以部署的应用程序.我想知道我是否应该将其升级到Rails 4.我也不确定哪些宝石在升级时会出现问题.
下面是我的Gemfile,里面有几个常见的宝石.
Gemfile.rb
source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'pg', '0.12.2'
gem 'bcrypt-ruby', '3.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'simple_form', '2.0'
gem 'rails3-jquery-autocomplete', '1.0.10'
gem 'show_for', '0.1'
gem 'paperclip', '3.3.1'
gem 'cocoon', '1.1.1'
gem 'google_visualr', '2.1.0'
gem 'axlsx', '1.3.4'
gem 'acts_as_xlsx', '1.0.6'
gem 'devise' ,'2.1.2'
gem 'cancan', '1.6.8'
gem 'bootstrap-datepicker-rails', "0.6.32"
gem 'country_select', '1.1.3'
gem 'jquery-rails', '2.1.4'
gem 'annotate', '2.5.0', group: :development
gem 'ransack', '0.7.2'
gem "audited-activerecord", "3.0.0"
gem 'prawn', '1.0.0.rc2'
gem 'exception_notification', '3.0.1'
gem 'daemons', …Run Code Online (Sandbox Code Playgroud) ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2 ruby-on-rails-4
我在rails应用程序中使用带有twitter bootstrap的谷歌图表.
在流体布局中,如果跨度宽度减小,则图表溢出其父div.
谷歌图表宽度可以百分比给出吗?
请帮忙.
更新
我正在使用google_visualr gem.
这是我的控制器代码.
def home
# Indents
indent_status_table = GoogleVisualr::DataTable.new
indent_status_table.new_column('string', 'STATUS')
indent_status_table.new_column('number', 'COUNT')
indent_status_table.add_rows(1)
indent_status_table.set_cell(0, 0, 'Open')
indent_status_table.set_cell(0, 1, 100)
opts = { :title => 'INDENT STATUS', :is3D => true }
@indent_status_chart = GoogleVisualr::Interactive::PieChart.new(indent_status_table, opts)
end
Run Code Online (Sandbox Code Playgroud)
这是我的html.erb代码
<div id='shipment_status_chart' style="width:100%; height:200px"></div>
<%= render_chart @shipment_status_chart, 'shipment_status_chart' %>
Run Code Online (Sandbox Code Playgroud)
并在java脚本代码中.
$(function() {
$(window).resize(function(){
drawChart();
});
});
Run Code Online (Sandbox Code Playgroud) 我有两种模型发票和发货。发票有_许多批货物,并且货物属于_到发票。
这就是我想要做的。
创建新货件。
new_shipment = Shipment.create! (params)
Run Code Online (Sandbox Code Playgroud)
检查此货件的合同是否已存在发票。
invoice = Invoice.find_by_ref_no(ref_no)
if invoice.nil?
invoice.shipments << new_shipment
invoice.save
else
Invoice.create! (some_params,
:shipment_ids => [new_shipment.id],
other_params
)
end
Run Code Online (Sandbox Code Playgroud)
我想知道添加发货后是否需要保存发票?此外,如何不先取货而直接添加货件?
我在发票中使用 :before_save 和 :after_save 来做一些处理。在控制台中,我尝试了这样的操作。
Invoice.last.shipments << (Shipment.first)
Invoice.last.shipments.count
Run Code Online (Sandbox Code Playgroud)
并且计数增加了。但我不确定 :before_save 和 :after_save 是否会运行,如果我明确不保存发票。
在这里,我从 excel 文件导入大数据,所以我想确保我不会两次保存发票。
activerecord ×1