小编sai*_*lor的帖子

用bundler更新一个gem

我使用bundler来管理我的rails应用程序中的依赖项,并且我在git存储库中托管了一个gem,如下所示:

gem 'gem-name', :git => 'path/to/my/gem.git'
Run Code Online (Sandbox Code Playgroud)

为了更新这个gem,我执行bundle update但它也更新了Gemfile中提到的所有gem.那么更新一个特定宝石的命令是什么?

ruby rubygems bundler

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

Rails日志太冗长了

如何防止Rails记录太多?这是我的production.log文件中的典型跟踪,许多部分,缓存命中......它在开发中很有用,但我不希望它在我的生产环境中.

Started GET "/?redirected=true" for 46.193.131.53 at 2012-08-16 18:39:20 +0200
Processing by HomeController#index as HTML
  Parameters: {"redirected"=>"true"}
  Rendered application/_successfully_connected.html.haml (0.8ms)
  Rendered hotspot_infos/_infos.html.haml (0.4ms)
  Rendered application/_hotspot_infos.html.haml (1.8ms)
  Rendered application/_news.html.haml (0.3ms)
Read fragment views/social-zone-341-directory (0.5ms)
  Rendered application/_directory.html.haml (2.5ms)
  Rendered application/_meteo.html.haml (1.1ms)
  Rendered application/_notifications.html.haml (0.8ms)
  Rendered application/_like_button.html.haml (0.3ms)
  Rendered application/_navbar.html.haml (4.2ms)
  Rendered application/_connection.html.haml (0.5ms)
  Rendered application/_gallery.html.haml (0.2ms)
  Rendered application/_search_bar.html.haml (0.4ms)
  Rendered pictures/_picture_frame.html.haml (0.3ms)
  Rendered application/_profile_preview.html.haml (1.4ms)
  Rendered application/_profile_block.html.haml (1.7ms)
  Rendered application/_menus.html.haml (3.3ms)
  Rendered application/_left_pane.html.haml (5.5ms)
  Rendered application/_langs.html.haml (0.8ms)
  Rendered application/_footer.html.haml (1.9ms)
  Rendered application/_flash_modal.html.haml …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails ruby-on-rails-3

24
推荐指数
2
解决办法
6562
查看次数

跳过与simple_form关联的包装器

我正在使用simple_form,我想知道在处理关联选择时是否可以跳过任何包装器div.

谢谢

ruby ruby-on-rails ruby-on-rails-3 simple-form

12
推荐指数
2
解决办法
8370
查看次数

如何在Gem中获取Rails应用程序的根目录

是否可以在应用程序中包含的gem代码中了解应用程序的Rails文件系统根目录?

这是宝石来源的样本:

module MyGem
  def self.included(base)
    puts Rails.root # return nil
  end
end

ActionController::Base.send :include, MyGem
Run Code Online (Sandbox Code Playgroud)

谢谢,抱歉我的英语不好

ruby rubygems ruby-on-rails

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

如何用假数据填充数据库?

我听说过像faker或populator这样的宝石,但它们有点老了(populator似乎与Rails 3并不相称).

所以我的问题是,你用什么来生成灯具?

ruby rubygems ruby-on-rails

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