Tag: rubygems

Rails参与! 错误(无法批量分配受保护的属性:用户)

我正在安装Engage! 我按照此处的安装说明进行操作: http : //engagecsm.com/readme 我做的安装步骤: 添加Engage! 到应用程序的Gemfile:gem’integcsm’。 安装它:捆绑安装。 运行生成器:rails generate engage user。 运行迁移:rake db:migrate。 现在,我可以去localhost:3000 /搞 这是出现的: 现在,当我点击“创建主题”时,网站上没有任何反应。 我看看我的rails服务器控制台,我看到了这个:(更容易在这里查看http://i.stack.imgur.com/xKBER.png ,在底部找到完整的堆栈跟踪) “✓”,“authenticity_token” >“aRKQAwMsnc1DJJ62S6bb7EkhFkzuCDtNL0kV756LIP4 =”,“topic”=> {“style”=>“问题”,“标题”=>“ww”,“message”=>“www”,“follow”=>“1”}, “commit”=>“创建主题”}用户负载(0.3ms)SELECT“users”。* FROM“users”WHERE“users”。“id”= 1 LIMIT 1 Engage :: UserProfile Load(0.4ms)SELECT“engage_user_profiles “。* FROM”engage_user_profiles“WHERE”engage_user_profiles“。”user_id“= 1 LIMIT 1(0.1ms)begin transaction Engage :: UserProfile Load(0.3ms)SELECT”engage_user_profiles“。* FROM”engage_user_profiles“INNER JOIN”users“ON “engage_user_profiles”。“user_id”=“users”。“id”WHERE“users”。“id”= 1 LIMIT 1 SQL(1.2ms)INSERT INTO“engage_topics”(“comments_count”,“created_at”,“followers_count”, “message”,“private”,“status”,“string”,“style”,“title”,“updated_at”,“user_id”,“votes_count”)VALUES(?,?,?,?,?,? ,?,?,?,?,?,?)[[“comments_count”,0],[“created_at”,Sun,2013年1月20日02:48:26 UTC […]

在Win7中的ruby命令提示符上安装Rubygems时出错

尝试在Win7(32位)的Ruby命令提示符下安装rubygems时出现以下错误。 请注意,我已经安装了Ruby1.9.3并将devkit(DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe)添加到Ruby中。 以下是我尝试过的所有事情: C:\devkit>ruby dk.rb init [INFO] found RubyInstaller v1.9.3 at C:/Ruby193 Initialization complete! Please review and modify the auto-generated ‘config.yml’ file to ensure it contains the root directories to all of the installed Rubies you want enhanced by the DevKit. C:\devkit>ruby dk.rb install [INFO] Updating convenience notice gem override for ‘C:/Ruby193’ [INFO] Installing ‘C:/Ruby193/lib/ruby/site_ruby/devkit.rb’ […]

包装导轨2.3型号

我在Rails上运行了一个现有的webapp。 计划是设置一个新服务器,它将提供API服务,并最终将webapp更新为此API的客户端。 实现这一目标的好方法似乎是将所有模型打包为gem并在两个应用程序之间共享它们。 最终,API服务将是单一的 – 包含所有模型,但是有一段时间需要共享模型的开发/迁移。 API和webapp都将使用相同的数据库。 在开始打包我的所有模型之前,我需要考虑什么? 是否值得将所有模型打包到一个gem中,单独打包每个模型,或者进行某种模型的逻辑分组? 我如何处理gem的依赖关系? 作为参考,这是一个类似的问题: 使用gem分享Rails应用程序之间的模型 我也熟悉将Ruby代码打包为Rubygem。 (这可能解释了我上面的一些问题。) [编辑]我使用的是Rails 2.3.14,而不是Rails 3.X.

为本地安装的gem生成RDOC

我正在努力为我最近感兴趣的一颗gem做出贡献 – 内斯塔。 开发人员在创建您可以找到的最轻,最最好的CMS之一方面做得很好,我想记录它。 我已经阅读了代码,并根据我的知识对一些方法进行了评论。 但是,我试图通过调用gem server在本地测试它,并在推送它之前查看我的机器上的更改。 我尝试过的事情: 手动编辑。 记录文件。 解雇了gem server 。 使用gem工具。 记录文件。 Ran gem rdoc nesta –rdoc 重启gem server 一切都无济于事。 请帮忙。 谢谢。

使用ruby-gmail阅读Gmail邮件

我正在寻找ruby-gmail gem中的一个实例方法,它允许我读取: 身体或 学科 的Gmail邮件。 在查看了这里找到的文档后,我找不到任何东西!? Gmail::Message类部分中有一个.message实例方法; 但是,由于缺乏一个更好的术语,它只会为身体发送电子邮件“mumbo-jumbo”。 我的尝试: #!/usr/local/bin/ruby require ‘gmail’ gmail = Gmail.connect(‘username’, ‘password’) emails = gmail.inbox.emails(:from => ‘someone@mail.com’) emails.each do |email| email.read email.message end 现在: email.read不起作用 email.message返回上面提到的“mumbo-jumbo” 有人在SO上提出这个问题,但没有得到答案。

gemspec中的日期格式规范无效

当我尝试在Windows中使用gems时,我收到以下错误,我也提到了这个stackoverflowpost和更新的rubygems和rails。 但没有什么能解决这个问题。 以下是完整的错误, D:\> gem env [D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效 /tilt-1.3.3.gemspec]:规范中的日期格式无效:“2011-08-25 00:00:00 .000000000Z” [D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效 /execjs-1.2.4.gemspec]:规范中的日期格式无效:“2011-08-03 00:00: 00.000000000Z” [D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效 /temple-0.3.3.gemspec]:规范中的日期格式无效:“2011-08-26 00:00: 00.000000000Z” [D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效 /guard-0.6.3.gemspec]:规范中的日期格式无效:“2011-09-01 00:00:0 0.000000000Z” [D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效 /guard-livereload-0.3.1.gemspec]:规范中的日期格式无效:“2011-09 -01 00:00:00.000000000Z“ [D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效 /rack-cache-1.0.3.gemspec]:规范中的日期格式无效:“2011-08-27 00 :00:00.000000000Z” [D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效 /tilt-1.3.3.gemspec]:规范中的日期格式无效:“2011-08-25 00:00:00 .000000000Z” [D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效 /execjs-1.2.4.gemspec]:规范中的日期格式无效:“2011-08-03 00:00: 00.000000000Z” [D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效 /temple-0.3.3.gemspec]:规范中的日期格式无效:“2011-08-26 00:00: 00.000000000Z” [D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效 /guard-0.6.3.gemspec]:规范中的日期格式无效:“2011-09-01 00:00:0 0.000000000Z” [D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效 /guard-livereload-0.3.1.gemspec]:规范中的日期格式无效:“2011-09 -01 00:00:00.000000000Z“ [D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/specifications中的gemspec无效 /rack-cache-1.0.3.gemspec]:规范中的日期格式无效:“2011-08-27 00 :00:00.000000000Z” RubyGems环境: […]

使用旧的rubygems版本捆绑安装

我有一个似乎是在1个月大的问题中看到的完全相同的问题 ,没有人触及过。 我使用自制软件安装了rbenv,使用rbenv install 2.3.1安装了ruby 2.3.1,使用gem install jekyll和gem install bundler gem install jekyll和gem install bundler ,然后在jekyll项目中输入了bundle install 。 我收到错误Rubygems 2.0.14.1 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation. Rubygems 2.0.14.1 is not threadsafe, so your gems will be installed […]

gem install:错误:无法构建gem原生扩展

我使用的是Arch Linux并安装了Ruby(这是2.0.0版本)。 当我安装Ruby时,它说我应该添加: $(ruby -rubygems -e “puts Gem.user_dir”)/bin 在我的路上,我把它添加到.bashrc 当我尝试gem安装rails或任何其他gem时,它会给出错误:无法构建gem原生扩展。 这是完整的错误: ERROR: While executing gem … (Gem::FilePermissionError) You don’t have write permissions for the /usr/lib/ruby/gems/2.0.0 directory. [alexander@localhost ~]$ sudo gem install rails –no-user-install Building native extensions. This could take a while… ERROR: Error installing rails: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb creating […]

以编程方式将ELPC节点添加到ELB

以下代码旨在将VPC中新部署的EC2实例添加到负载均衡器。 (这显然是测试/虚拟代码,但实际工作流程在实际系统中是相同的) require ‘yaml’ gem ‘aws-sdk’,’1.6.0′ require ‘aws-sdk’ AWS.config({ :access_key_id => KEY, :secret_access_key => SECRET_KEY }) ec2 = AWS::EC2.new elb = AWS::ELB.new i = ec2.instances[“i-abcd1234”] elb.load_balancers[“lb-name”].instances.register(i) 当我运行此代码时,我收到此错误: AWS::ELB::Errors::ValidationError: ELB in VPC is not supported in this version of API. Please try 2011-11-15 or newer. 我的aws-sdk gem是RubyGems提供的最新版本,本周更新了。 这不是Ruby SDK for AWS中可用的function吗? 如何通过此gem或其他方式将VPC节点添加到带有Ruby代码的Load Balancer?

评估Ruby上的javascript

我尝试获取网页的代码html,但网页包含一些生成我需要的数据的javascript代码。 http = Net::HTTP.new(‘localhost’) path = ‘/files.php’ # POST request -> logging in data = ” headers = { ‘Referer’ => ‘http://localhost:8080/files.php’, ‘User-Agent’ => ‘Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0’, ‘Accept’ => ‘text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8’, ‘Accept-Language’ => ‘es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3’, ‘Content-Encoding’ => ‘gzip, deflate’, ‘Connection’ => ‘keep-alive’, ‘Cookie’ => ” } resp, data = http.post(path, data, headers) […]