Rails

Ruby on Rails 3 : “superclass mismatch for class …”

匿名 (未验证) 提交于 2019-12-03 08:39:56
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Platform: Mac OSX 10.6 In my terminal, i start the Ruby console with "rails c" While following the Ruby on Rails 3 tutorial to build a class: class Word i get the error message: TypeError: superclass mismatch for class Word from (irb):33 from /Users/matthew/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.5/lib/rails/commands/console.rb:44:in `start' from /Users/matthew/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.5/lib/rails/commands/console.rb:8:in `start' from /Users/matthew/.rvm/gems/ruby-1.9.2-p180@rails3tutorial

Rails 5 Action Cable deployment with Nginx, Puma & Redis

匿名 (未验证) 提交于 2019-12-03 08:36:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to deploy an Action Cable -enabled-application to a VPS using Capistrano. I am using Puma, Nginx, and Redis (for Cable). After a couple hurdles, I was able to get it working in a local developement environment. I'm using the default in-process /cable URL. But, when I try deploying it to the VPS, I keep getting these two errors in the JS-log: Establishing connection to host ws : //{server-ip}/cable failed. Connection to host ws : //{server-ip}/cable was interrupted while loading the page. And in my app-specific nginx

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

Why is 'jQuery-Rails' often outside of the asset group

匿名 (未验证) 提交于 2019-12-03 08:35:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Why is it that I often see gem 'jquery-rails outside of the :assets group? group :assets do gem 'sass-rails', " ~> 3.1.0" gem 'coffee-rails', " ~> 3.1.0" gem 'uglifier' end gem 'jquery-rails' Will there be buggy behavior if I put it inside? Thanks! 回答1: The jquery-rails gem provides some test helpers also. So perhaps for that reason people prefer to put it outside the :assets group. However, the :assets group is included in development and testing environment, so you should be perfectly safe to place jquery-rails in your :assets group if you

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

Rails + Dalli memcache gem: DalliError: No server available

匿名 (未验证) 提交于 2019-12-03 08:35:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Hi I'm having trouble setting up my Rails project on my server because apache keeps complaining DalliError: No server available . I installed memcached on my ubuntu machine, but it still doesn't work. My rails project also has config.cache_store = :dalli_store, 'localhost:11211', { :namespace => "production" } in environments/production.rb. How would I debug this? My log shows before each request: localhost:11211 failed (count: 6) DalliError: No server available telnet to 11211: root@s2:/usr/local/www/production/current/log# telnet localhost

Rails 3.2 + MySQL: Error: Field 'created_at' doesn't have a default value: INSERT INTO

匿名 (未验证) 提交于 2019-12-03 08:35:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I created a new migration, where is mentioned ... t.timestamps in the created table are added these two columns ... | created_at | datetime | NO (Null) | | NULL (Default) | | updated_at | datetime | NO (Null) | | NULL (Default) | ... When I want to create a new item, I always get the error message Mysql2::Error: Field 'created_at' doesn't have a default value: INSERT INTO `table_name` (`first_col`, `second_col`) VALUES ('a', 'b') Am I missing something? I sent this miniapp to a friend of mine and he is able to run successfully run it -> the

Rails 2: Model.find(1) gives ActiveRecord error when id 1 does not exist

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using Rails 2.3.5 and in that if I give Model.find(1) and if 1 is not in the database, it returns ActiveRecord error. Should it just be returning nil as in the case of Model.find_by_column('..') ? 回答1: This is the expected behavior. I think David explains this the best himself, so here is a quote from Ruby, S., Thomas, D. & Hansson, D.H., 2009. Agile Web Development with Rails , Third Edition Third Edition., Pragmatic Bookshelf (p.330). On the other hand, finders that use criteria to search are looking for a match. So, Person.find(

Rails 3 Form For Custom Action

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm having trouble routing a form to a custom action in Rails 3. Here are my routes: resources : photos do resources : comments collection do get 'update_states' end member do put 'upload' end end Here's the form_for: form_for @photo , : remote => true , : url => { : action => upload_photo_path ( @photo ) }, : html => { : multipart => : true , : method => 'put' } do | f | And here's the error message: No route matches {: action => "/photos/42/upload" , : controller => "photos" } ... this is especially frustrating because "photos/

Best Ruby on Rails WebSocket tool [closed]

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I started project in Rails 3 and I need to add notifications(like Facebook one). Best way would be using WebSocket for support devices like iPad, but I can't find any good tools to easy implement it in Rails. I found Pusherapp, but they prices are overwhelming, and also I don't think that providing my data to third party company would be wise. So things needed: Open Source Some kind of channels support Helpers for Rails(and working with Rails 3) 回答1: If you are searching plain WebSocket implementation, then EM-WebSocket is probably best. If