什么是Time Zone,就是时区,UTC或者是GMT
UTC = Coordinated Universal Time. 中文名称为协调世界时
GMT = Greenwich Mean Time. 中文名称为格林尼治时
新建一个rails项目,默认是utc时间。
可以运行ActiveSupport::TimeZone.all.map(&:name)查看所以时区。
在往数据库插入数据时,所有时间都早了8个小时
fix: 在application.rb中添加
#rails默认是utc,改成本地时间
config.time_zone = 'Beijing'
config.active_record.default_timezone = :local
相关推荐
rails-timezone-js 类使用的时区名称格式与IANA维护的标准使用的格式不同。 rails-timezone-js提供了使用ActiveSupport中的在ActiveSupport时区名称之间进行转换的功能。 该库可以在node.js和浏览器中使用。 用法...
gem 'browser-timezone-rails' 确保您的application.js中包含以下每个条目: //= require js.cookie //= require browser_timezone_rails/set_time_zone 而已! 无需其他配置,因为使用此gem可以完成所有工作,...
rails-timeago提供了一个timeago_tag助手来创建可用于插件的时间标签。 安装 将此行添加到您的应用程序的Gemfile : gem 'rails-timeago' , '~> 2.0' 然后执行: $ bundle 或将其自己安装为: $ gem install ...
Rails3教程系列 DRY(Dont Repeat Yourself) DRY(Dont Repeat Yourself) DRY(Dont Repeat Yourself) DRY(Dont Repeat Yourself) DRY(Dont Repeat Yourself) DRY(Dont Repeat Yourself) DRY(Dont Repeat Yourself) DRY...
Rails 3 in Action 2011年9月新鲜出炉,针对最新的Rails 3.1进行说明
Windows7_Cygwin_Git_RVM_Ruby1.9.3_Rails3_MongoD B_Nginx_Unicorn_Rspec_Guard_Spork(2-Ruby on Rails3 安装配置
turbo-sprockets-rails3, 加速你的Rails 3资产 用于 Rails 3.2.x的涡轮链轮 通过只根据源文件的哈希来重新编译已经更改的资产,从而加快 Rails 3 rake assets:precompile的速度只编译一次以生成指纹和非打印的资产...
Rails3消息队列系统 Sidekiq
Ruby+on+Rails+3+Tutorial.pdf 应用Rails进行敏捷Web开发第4版.pdf (Agile Web Development with Rails) Rails.Recipes.Rails.3.Edition.pdf
rails3的英文文档
Rails3的ActiveRecord 查询API.doc
The Rails™ 3 Way is a comprehensive resource that digs into the new features in Rails 3 and perhaps more importantly, the rationale behind them. —Yehuda Katz, Rails Core The Bible for Ruby on ...
3 rails # gem install rails -v=2.3.11 4 passenger # gem install passenger passenger-install-apache2-module 安装完成后按照提示将下面的内容添加到etc/httpd/httpd.conf LoadModule pa
rails常用命令,例如新建rails项目,新建controller、model 等等
The Rails™ 3 Way is the only comprehensive, authoritative guide to delivering production-quality code with Rails 3. Pioneering Rails expert Obie Fernandez and a team of leading experts illuminate ...
ruby on rails开发的初学者很适合的工具书,易上手,很实用,
基于java的开发源码-Rails3消息队列系统 Sidekiq.zip 基于java的开发源码-Rails3消息队列系统 Sidekiq.zip 基于java的开发源码-Rails3消息队列系统 Sidekiq.zip 基于java的开发源码-Rails3消息队列系统 Sidekiq.zip ...
This pioneering book is the first resource that deep dives into the new Rails 3 APIs and shows you how use them to write better web applications and make your day-to-day work with Rails more ...
jquery-rails, 一个 gem,用于自动使用jQuery和 Rails 3 railsjQuery 面向 Rails 如此伟大。这里 gem 提供:jQuery 1.7.2jQuery UI 1.8.18 ( 仅适用于 javascript )jQuery UJS适配器assert_select_j