DB上的错误:迁移“未初始化的常量DeviseCreateUsers”

我正在尝试在Heroku上运行rake db:migrate命令,我遇到了这个问题。 uninitialized constant DeviseCreateUsers /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb:230:in `block in constantize’ /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb:229:in `each’ /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb:229:in `constantize’ /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.11/lib/active_support/core_ext/string/inflections.rb:54:in `constantize’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/migration.rb:538:in `load_migration’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/migration.rb:533:in `migration’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/migration.rb:528:in `migrate’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/migration.rb:720:in `block (2 levels) in migrate’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/migration.rb:775:in `call’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/migration.rb:775:in `block in ddl_transaction’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/transactions.rb:208:in `transaction’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/migration.rb:775:in `ddl_transaction’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/migration.rb:719:in `block in migrate’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/migration.rb:700:in `each’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/migration.rb:700:in `migrate’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/migration.rb:570:in `up’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/migration.rb:551:in `migrate’ /app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.11/lib/active_record/railties/databases.rake:179:in `block (2 levels) […]

更新到gem 1.8.1时出现rubyonrails错误

我将gem更新到最新的1.8.1,现在当我使用rails命令时,我得到如下错误 NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01. Gem::Specification#default_executable= called from /Library/Ruby/Gems/1.8/specifications/rubygems-update-1.7.2.gemspec:11. NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01. Gem::Specification#default_executable= called from /Users/Haxrat/.gem/ruby/1.8/specifications/RedCloth-4.2.7.gemspec:10.

你如何激活或设置默认耙?

我见过很多 You have already activated rake 0.9.x, but your Gemfile requires rake 0.xx 错误。 当然,它们可以通过以下某些方法(临时或永久)解决。 bundle exec rake 上面的方法有效,但你总是要输入bundle exec。 它也可以通过解决 bundle update 但捆绑更新还会更新您的其他gem。 有人说它可以解决 gem uninstall unwanted_rake_version 是的,可以安装不需要的rake,但它仍然标记为已激活,因此仍然会出错。 一种解决方案是在Gemfile中明确指定rake版本,但这不是问题。 它是关于如何设置默认rake版本,或在rvm或其他类型的ruby安装中激活该特定版本?

如何在OS X 10.5.4下安装mysql ruby​​ gem

这是交易。 $ gem –version 1.1.0 $ sudo gem install mysql – –with-mysql-config = / usr / local / mysql / bin / mysql_config 批量更新Gem源索引: http : //gems.rubyforge.org/错误:无法在本地或存储库中找到mysql $ sudo gem update 更新已安装的gems批量更新Gem源索引: http : //gems.rubyforge.org/ 更新RedCloth错误:执行gem时…(Gem :: GemNotFoundException)无法在本地或存储库中找到RedCloth 我试过这个 , 这个 , 这个 ,以及其他很多。 他们都没有为我工作。 还有其他人有这个问题吗? 如果是这样你做了什么来解决它上面没有提到的?

如何选择在Ruby中动态包含哪个版本的模块?

我正在编写一个小型的Ruby命令行应用程序,它使用标准库中的fileutils进行文件操作。 根据用户调用应用程序的方式,我将要包括FileUtils , FileUtils::DryRun或FileUtils::Verbose 。 既然include是私有的,我不能把逻辑选择到对象的initialize方法中。 (这是我的第一个想法,从那时起我就可以将有关用户选择的信息作为参数传递给new 。)我已经提出了两个似乎有用的选项,但我对以下两种方法都不满意: 根据用户的选择在应用程序的命名空间中设置一个全局变量,然后在类中执行条件包含: class Worker case App::OPTION when “dry-run” include FileUtils::DryRun etc. 创建子类,唯一的区别是它们包含哪个版本的FileUtils 。 根据用户的选择选择合适的一个。 class Worker include FileUtils # shared Worker methods go here end class Worker::DryRun < Worker include FileUtils::DryRun end class Worker::Verbose < Worker include FileUtils::Verbose end 第一种方法似乎是DRY-er,但我希望有一些我没有想到的更简单的方法。

使用Ruby gem部署shell脚本并安装在bin目录中

我希望在我的gem的bin目录中放置一个shell脚本,以及属于该包的其他Ruby程序。 我希望将这个shell脚本原样安装在bin目录中(即没有包装器)。 这可能与Rubygem有关吗? 如果没有其他可能,我会对安装后挂钩感到满意。 有人有这方面的经验吗?

你推荐哪种State Machine插件用于Rails?

我正在为Rails 3 / Active Record项目寻找一个相对简单的状态机插件。 我做了一些研究,并提出了以下插件: 转换 : https : //github.com/qoobaa/transitions 从旧的Active Record State Machine Library中提取 Acts_As_State_Machine : https : //github.com/aasm/aasm 工作流程 : https : //github.com/geekq/workflow 状态机 : https : //github.com/pluginaweek/state_machine 州流程 : https : //github.com/ryanza/stateflow 但它们看起来非常相似,所以我很想知道是否有人有任何实际经验。 谢谢!

Rails 3 Active Record关系顺序:使用hash而不是string

要在Rails 3中对关系进行排序,我们必须这样做: User.where(:activated => true).order(‘id ASC’) 但我认为这个: User.where(:activated => true).order(:id => :asc) 会有更好的意义,因为字段名称的转义方式应该取决于适配器( SqlLite vs Mysql vs PostgreSQL ),对吧? 有类似的东西吗?

Ruby on Rails Collection选择 – 如何预先选择正确的值?

我花了最后三天的时间来处理我的“列表” – 表单的集合_选择表单助手,用户可以在其中选择一个类别。 我想将listing.category_id中当前设置的类别作为预选值。 我的视图代码如下所示: 10, :selected => @listing.category_id.to_s})%> 我知道这是不正确的,但即使阅读Shiningthrough( http://shiningthrough.co.uk/blog/show/6 )的解释,我也无法理解如何继续。 感谢您的支持, 迈克尔 查看:如上所述 控制器: def categories #Step 2 @listing = Listing.find(params[:listing_id]) @seller = Seller.find(@listing.seller_id) @category = Category.find(:all) @listing.complete = “step1” respond_to do |format| if @listing.update_attributes(params[:listing]) flash[:notice] = ‘Step one succesful. Item saved.’ format.html #categories.html.erb end end end

是否有镀铬开关来抑制“外部协议请求”?

是否有镀铬开关来抑制“外部协议请求”? 我正在使用selenium – ruby​​ – watir webdriver自动化应用程序。 我在网上搜索了绕过此窗口和对话的解决方案: http : //productforums.google.com/forum/#!topic/chrome/K22hXwRy6zQ概述了我们如何手动执行此操作。 但对于Selenium-Chrome-Ruby,我需要通过设置chrome开关来实现这一点(chorme开关列表:= http://src.chromium.org/svn/trunk/src/chrome/common/chrome_switches.cc ) 。 这是一个巨大的清单。 我需要帮助找出哪个开关可能会帮助我绕过外部协议请求窗口,或者通过自动化有什么解决方法?