小编cod*_*odr的帖子

git diff显示不够

我想看看master分支和我的功能分支之间的区别.我有很多从主服务器到我的功能分支的东西,并希望看到如果我将我的功能合并到主服务器中将添加的更改.

这是我的情况:

-*--*--*-----*<master>
  \     \     \
   1--*--*--*--2--*<feature>
Run Code Online (Sandbox Code Playgroud)

我的问题是git diff master feature似乎只显示提交号2.我想看到一个github pull请求将显示的差异,我相信这是提交的所有方式1.我注意到git cherry显示我提交的我希望看到的区别为.

谢谢你的建议.

git github git-diff

26
推荐指数
2
解决办法
1万
查看次数

rails mysql adapter错误

我无法找到解决此问题的方法.我收到了错误

请安装mysql适配器:'gem install activerecord-mysql-adapter'

当我指定ruby-mysqlmysql2在我的Gemfile.这是因为我升级到Rails 3.1.0-rc1后才发生这种情况.我正在运行OSX 10.6,Ruby 1.9.2.

cody$ rails c
/Users/cody/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc1/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection': Please install the mysql adapter: `gem install activerecord-mysql-adapter` (mysql is not part of the bundle. Add it to Gemfile.) (RuntimeError)
from /Users/cody/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc1/lib/active_record/connection_adapters/abstract/connection_specification.rb:68:in `establish_connection'
from /Users/cody/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc1/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection'
from /Users/cody/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc1/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
from /Users/cody/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc1/lib/active_record/railtie.rb:69:in `block (2 levels) in <class:Railtie>'
from /Users/cody/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc1/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /Users/cody/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /Users/cody/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc1/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from /Users/cody/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc1/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /Users/cody/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc1/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /Users/cody/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc1/lib/active_record/base.rb:2135:in `<top (required)>'
from /Users/cody/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.1.0.rc1/lib/active_record/railtie.rb:34:in …
Run Code Online (Sandbox Code Playgroud)

mysql ruby-on-rails-3.1

16
推荐指数
2
解决办法
3万
查看次数

谷歌地图API 3缩小了fitBounds

我遇到了一个调用map.fitBounds似乎缩小的问题.我正在尝试使用backbone.js路由器来保存网址中的地图边界.我希望能够为网址添加书签,然后让地图看起来完全一样.

我注意到map.fitBounds(map.getBounds())在控制台中调用将始终缩小.我想在哪里不改变地图.

这是正常的行为吗?我如何强制执行此操作,以便从一个步骤到另一个步骤看起来相同?

谢谢

google-maps-api-3 fitbounds

8
推荐指数
3
解决办法
5648
查看次数

高效批量更新rails数据库

我正在尝试构建一个rake实用程序,它会经常更新我的数据库.

这是我到目前为止的代码:

namespace :utils do

  # utils:update_ip
  # Downloads the file frim <url> to the temp folder then unzips it in <file_path>
  # Then updates the database.

  desc "Update ip-to-country database"
  task :update_ip => :environment do

    require 'open-uri'
    require 'zip/zipfilesystem'
    require 'csv'

    file_name = "ip-to-country.csv"
    file_path = "#{RAILS_ROOT}/db/" + file_name
    url = 'http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip'


    #check last time we updated the database.
    mod_time = ''
    mod_time = File.new(file_path).mtime.httpdate    if File.exists? file_path

    begin
      puts 'Downloading update...'
      #send conditional GET to server
      zipped_file = …
Run Code Online (Sandbox Code Playgroud)

activerecord bulkinsert ruby-on-rails

5
推荐指数
1
解决办法
1万
查看次数