草庐IT

create_window

全部标签

ruby-on-rails - 无法在 Windows 7 上安装 MySQL2 gem

我在安装时收到以下错误消息,如果我需要发布更多详细信息,请告诉我。我按照以下位置的说明操作:https://github.com/oneclick/rubyinstaller/wiki/Development-Kit我正在使用ruby​​1.9.2p136(2010-12-25)[i386-mingw32]。这是我得到的:E:\work_desk\trunk>geminstallmysql2-v0.2.4TemporarilyenhancingPATHtoincludeDevKit...Buildingnativeextensions.Thiscouldtakeawhile...ERR

ruby - 在 Windows 上的 Ruby 1.9.1 上安装 Hpricot

我正在尝试使用以下命令安装hpricot:>geminstallhpricot-v0.8.2Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallinghpricot:ERROR:Failedtobuildgemnativeextension.C:/Ruby19/bin/ruby.exeextconf.rbcheckingforstdio.h...*extconf.rbfailed*CouldnotcreateMakefileduetosomereason,probablylackofnecessarylibr

ruby-on-rails - rails : creating a custom data type/creating a shorthand

我想知道如何创建自定义数据类型以在rake迁移文件中使用。示例:如果您要创建模型,则可以在迁移文件中添加列。它可能看起来像这样:defself.upcreate_table:productsdo|t|t.column:name,:stringt.timestampsendend我想知道如何创建这样的东西:t.column:name,:my_custom_data_type之所以这样创建,例如一个“货币”类型,无非是一个精度为8,小数位数为2的小数。由于我只使用MySQL,所以这个数据库的解决方案已经足够了。感谢您的反馈和意见! 最佳答案

ruby-on-rails - 错误 "' Validate_default_type !': An option' s default must match its type (ArgumentError)"when running Ruby on Rails generate on Windows

我正在关注thistutorial并且刚刚开始。我已经使用geminstallrails安装了RubyonRails,并使用railsnewblog创建了一个博客。教程现在说我需要运行railsgeneratecontrollerWelcomeindex,但是当我这样做时,我得到了这个错误:C:/Ruby22/lib/ruby/gems/2.2.0/gems/thor-0.19.2/lib/thor/parser/option.rb:130:in`validate_default_type!':Anoption'sdefaultmustmatchitstype.(ArgumentErr

ruby-on-rails - Zeus + FactoryGirl::语法::方法。未定义的方法 `create'

我有:RSpec.configuredo|config|config.includeFactoryGirl::Syntax::Methodsend它可以与简单的rspecspec/model/user_spec.rb一起正常工作(允许我使用create(:user),而不是FactoryGirl.create(:用户))。但是如果我使用zeusrspecspec/model/user_spec.rb来加速我的规范,它会给我一个错误:Failure/Error:@user=create(:user)NoMethodError:undefinedmethod`create'for#如何将此

ruby-on-rails - Ruby 1.9.2 如何在 Windows 上安装 RMagick?

我目前正在升级一个旧的Rails应用程序以使用Rails3和Ruby1.9.2,而RMagick是我需要安装的最后一个gem。然而,似乎没有任何适用于Windows的1.9.2下载,标准的gem安装RMagick也不起作用。有人能为我指出正确的方向来安装这个gem吗? 最佳答案 我刚刚使用Rubyv1.9.x在Windows上成功安装了RMagick2.13.1!在我忘记之前,让我把程序说出来。安装开发工具包:https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

ruby-on-rails - ruby rails : Can I do a "link_to" to call a create action?

如何从link_to正确调用创建操作?我正在使用REST(map资源:食谱)。这是创建操作:defcreaterecipe=Recipe.create(:name=>"Frenchfries")redirect_torecipeend例如,我认为这样的事情可能会奏效::post%>我不确定这是否是推荐的(甚至是正确的)方法。有什么想法吗? 最佳答案 如果您将recipe_path替换为recipe_path,那应该可以工作。如果您查看rakeroutes的输出,您应该会看到如下内容:recipesGET/recipes(.:form

javascript - rake 数据库 :create - Could not find a JavaScript runtime

这是我得到的错误:sergio@sergio-VirtualBox:~/blog$rakedb:createrakeaborted!CouldnotfindaJavaScriptruntime.Seehttps://github.com/sstephenson/execjsforalistofavailableruntimes.(Seefulltracebyrunningtaskwith--trace)sergio@sergio-VirtualBox:~/blog$所以经过一些搜索,我似乎需要为Ruby安装一个Javascript运行时。许多不同的选项之间有区别吗?看来Node.js是

Windows PowerShell在CSV文件中的每个对象的开头添加文本

我有这样的CSV文件:samaccountname,enableduser1,falseuser2,false我想在samaccaountname列中使用每个条目,并添加此确切的文本:C:\Users\然后,我需要创建一个新的CSV文件,该文件仅包含一个带有这样的新数据的单列:headerC:\Users\User1C:\Users\User2C:\Users\User3完成此操作的最佳方法是什么?看答案这只猫皮肤的另一种方法是通过Select-Object使用自定义属性创建:import-csv$yourcsv|Select-Object*,@{Name="fullpath";Express

ruby-on-rails - Rails ActiveRecord:PG::错误:错误:列引用 "created_at"不明确

我正在努力解决对象中的错误,但完全不确定问题出在哪里。这是模型的样子:classCar:car_colorsendclassCarColor:car_colorsend这里是查询:@cars=Car.all(:joins=>:car_colors,:conditions=>{:car_colors=>{:color_id=>params[:id_number]}},:order=>"cars.created_atDESC")错误输出:PG::Error:ERROR:columnreference"created_at"isambiguousLINE1:...d"WHERE"car_co