gems

ActiveRecord Rails 3 scope vs class method

匿名 (未验证) 提交于 2019-12-03 08:41:19
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm new to the new query interface of ActiveRecord so I'm still figuring things out. I was hoping someone could explain the difference between using a scope in an ActiveRecord model and just using a class method (ie self.some_method ) From what I can gather, a scope is always expected to return a relation, whereas a class method doesn't necessarily have to. Is this true? For instance, I thought it would make sense to do something like: class Person scope :grouped_counts, group(:name).count end But this doesn't work. I get this error:

Rails/Passenger/Node.js: ExecJS “Could not find a JavaScript runtime”

匿名 (未验证) 提交于 2019-12-03 08:35:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to use Node.js as the JavaScript runtime for my Rails application. I'm using the Phusion Passenger module with Nginx as my web server on Ubuntu 12.0.4. Every time I visit my Rails application I get an error page that appears to be generated from Passenger stating that ExecJS can't find a JavaScript runtime. I've seen numerous posts on here that either suggest that you install Node--which I have done via sudo apt-get install node --or suggest using therubyracer + execjs in your Gemfile. That latter solution does in fact work, but I

Invalid request: Invalid HTTP format, parsing fails

匿名 (未验证) 提交于 2019-12-03 08:35:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm constantly getting this error in rails server log: Invalid request: Invalid HTTP format, parsing fails. /home/budkin/gamestown/vendor/cache/ruby/2.0.0/gems/thin-1.6.1/lib/thin/request.rb:84:in `execute' /home/budkin/gamestown/vendor/cache/ruby/2.0.0/gems/thin-1.6.1/lib/thin/request.rb:84:in `parse' /home/budkin/gamestown/vendor/cache/ruby/2.0.0/gems/thin-1.6.1/lib/thin/connection.rb:41:in `receive_data' /home/budkin/gamestown/vendor/cache/ruby/2.0.0/gems/faye-websocket-0.7.2/lib/faye/adapters/thin.rb:44:in `receive_data' /home/budkin

Deployment to Elastic Beanstalk fails with 'Cannot allocate memory' error

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I built a rails application that I want to deploy to elastic beanstalk. I was able to deploy it to my AWS account but now I want to deploy it to my clients account. For some reason it I get errors when trying to deploy it. Have been able to deploy it to my account from scratch and been able to deploy it to heroku but every time I try to deploy it to my clients account I get a bunch of errors. Are there possible settings that would be different between the two accounts? I don't understand why deploying to the two accounts would be any

Activated Ruby RAKE 10.0.1, require 10.0.0

匿名 (未验证) 提交于 2019-12-03 07:36:14
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I get this error when i try to run "rake test": avery@ubuntu:~/rails_projects/depot$ rake test rake aborted! You have already activated rake 10.0.1, but your Gemfile requires rake 10.0.0. Using bundle exec may solve this. /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler/runtime.rb:31:in `block in setup' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler/runtime.rb:17:in `setup' /home/avery/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.2.2/lib/bundler.rb:116:in `setup' /home/avery/.rvm/gems/ruby-1.9.3-p327

How to resolve deserialization error in delayed job?

你。 提交于 2019-12-03 04:15:54
I am trying to use DelayedJob and the job is failing, giving the following error in the database: {Delayed::DeserializationError /Library/Ruby/Gems/1.8/gems/delayed_job-2.1.3/lib/delayed/serialization/active_record.rb:7:in `yaml_new' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in `transfer' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in `node_import' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml.rb:133:in `load' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8

How do I install ruby gems on Mac

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: How do I install RubyGems on my Mac? I tried to run $ gem install rubygems-update with no luck . It returns ERROR : While executing gem ... ( Gem :: FilePermissionError ) You don 't have write permissions for the /Library/Ruby/Gems/2.0.0 directory. Any help would be great. Thanks 回答1: I would highly suggest using a package manager and a Ruby Environment Manager. On Mac: brew update brew install ruby # If you use bash echo 'export PATH=/usr/local/Cellar/ruby/2.4.1_1/bin:$PATH' >> ~/. bash_profile # If you use ZSH: echo 'export PATH=

Rails server does not start -> Could not find a JavaScript runtime [duplicate]

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: execJs: 'Could not find a JavaScript runtime' but execjs AND therubyracer are in Gemfile 20 answers I created a new rails app in folder 'issues' and when I wanted to 'ruby s' I got an error. Any help will be much appreciated [thiago@netbox issues]$ rails s /home/thiago/.rvm/gems/ruby-1.9.3-p429/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) from

Undefined method raise_in_transactional_callbacks=' for ActiveRecord::Base:Class (NoMethodError)

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Before writing this question I looked at these answers, but was unable to find a solution.: Error when execute rails generate scaffold User name:string email:string rake aborted! undefined method `migration_error=' for ActiveRecord::Base:Class Error launching Rails server: undefined method 'configure' When I try to start a new application (for Hartl's tutorial , Chapter 2), at the stage scaffold start, I got an error like: **undefined method `configure' for # (NoMethodError)** But thanks to the above examples, I edited the development.rb

rails server cannot start; getaddrinfo: nodename nor servname provided, or not known (SocketError)

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have not found a solution to the problem, however someone did already ask about the same problem a few days ago - ( Rails Server Keeps Exiting (SocketError) ) After I start a rails server the system returns some error I cannot understand. To install Ruby on Rails on my mac I did everything as listed on http://railsapps.github.io/installrubyonrails-mac.html here is my terminal response: $ rails server => Booting WEBrick => Rails 4.2.0 application starting in development on http://localhost:3000 => Run `rails server -h` for more startup