Why won't my rails server work in cloud9 - ruby-on-rails

My ruby on rails server suddenly stopped working (Cloud9, Mac OS). This is the error msg I keep getting:
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/values/time_zone.rb:285: warning: circular argument reference - now
/usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.1.0/lib/rails/commands/server.rb:34:in `parse!': missing argument: -p (OptionParser::MissingArgument)
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.5.5/lib/rack/server.rb:293:in `parse_options'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.5.5/lib/rack/server.rb:184:in `options'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.1.0/lib/rails/commands/server.rb:60:in `set_environment'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.1.0/lib/rails/commands/server.rb:44:in `initialize'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `new'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `server'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.1.0/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I've tried everything I could find on here but no luck. Apologies if this solution is on here somewhere. Here's my Gem file
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', group: [:development, :test]
# Use postgresql as the database for production
group :production do
gem 'pg'
gem 'rails_12factor'
end
# Use SCSS for stylesheets
gem 'sass-rails', '4.0.3'
# Use bootstrap library for styles
gem 'bootstrap-sass', '3.3.1'
# Use font awesome library for icons
gem 'font-awesome-sass', '4.2.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
# gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# Use devise for user auth
gem 'devise', '~>3.4.1'
# Use stripe for handling payments
gem 'stripe', '1.16.1'
# Use figaro to hide secret keys
gem 'figaro', '1.0.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]

In cloud9 (as opposed to nitrous ;) you start your server with rails s -b $IP -p $PORT

Related

trouble running ruby on rails console on mac

I am having trouble getting rails to run on my mac. This is the output that I get. It seems to be a problem with my packages or the Ruby or rvm version, but I don't know how to resolve it. I end up having to deploy to Heroku every time to test something.
Pauls-MacBook-Pro:heroku paulyang$ rails console
/Users/paulyang/.rvm/gems/ruby-2.3.3/gems/spring-2.0.1/lib/spring/application.rb:108:in `ensure in preload': undefined method `application' for Rails:Module (NoMethodError)
from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/spring-2.0.1/lib/spring/application.rb:112:in `preload'
from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/spring-2.0.1/lib/spring/application.rb:143:in `serve'
from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/spring-2.0.1/lib/spring/application.rb:131:in `block in run'
from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/spring-2.0.1/lib/spring/application.rb:125:in `loop'
from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/spring-2.0.1/lib/spring/application.rb:125:in `run'
from /Users/paulyang/.rvm/gems/ruby-2.3.3/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in `<top (required)>'
from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
This is the gemfile I'm using for my Rails app:
source 'https://rubygems.org'
ruby '2.3.3'
gem 'sinatra'
# sinatra needs old tilt version: http://stackoverflow.com/questions/20648394/moduletemplates-uninitialized-constant-tiltcompilesite-nameerror-using
#https://groups.google.com/forum/#!topic/sinatrarb/mAtn7AZBVmY
gem 'tilt', '~> 1.4.1', group: :production
gem 'rest-client'
gem 'sequel'
gem 'sqlite3', group: :development
gem 'pg', '~> 0.18', group: :development
gem 'cowsay'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18', group: :production
gem 'rails_12factor', group: :production
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'puma'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# for auto-renewable subscription validation
# https://github.com/gabrielgarza/monza/blob/master/README.md
gem 'monza'
gem 'itunes-receipt'
Any help would be great.

Rails 4 & Ruby 1.9 error generating mongoid:config

I'm trying to create a ruby on rails app which can be hosted on Openshift, but i encounter the following error when i try to use the rails g mongoid:config command through terminal. I've tried everything i found on stackoverflow but the error still persists! what am i doing wrong?
here is the error:
/home/themis/.rvm/gems/ruby-2.3.0/gems/activesupport-4.0.3/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now
/home/themis/rails4/config/application.rb:6:in `require': cannot load such file -- active_job/railtie (LoadError)
from /home/themis/rails4/config/application.rb:6:in `<top (required)>'
from /home/themis/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:82:in `require'
from /home/themis/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:82:in `preload'
from /home/themis/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:143:in `serve'
from /home/themis/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /home/themis/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /home/themis/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /home/themis/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/themis/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/themis/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
and my Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'
gem 'mongoid', git: 'https://github.com/mongoid/mongoid.git'
gem 'twitter-bootstrap-rails'
gem 'less-rails'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
gem "rspec"
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console'
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
This is an ActiveSupport bug (thus a Rails bug).
Line 282 at activesupport-4.0.3/lib/active_support/values/time_zone.rb is
def parse(str, now=now)
# ...
end
And line 308 of the same file is
def now
# ...
end
The problem is at the default param now=now, which ruby struggles to understand whether the latter now is a method call or is just a local variable (the param itself).
If you modify the now=now to now=now(), then all is fine.
This bug is fixed in Rails 4.0.6.

RubyOnRails Error with gem rinruby

I'm trying to use rinruby 2.0.3.
In my Gemfile:
gem 'rinruby', '~> 2.0.3'
When I execute bundle install, I don't have any problem. But when I execute:
rake db:migrate
I've got this error:
$ rake db:create
rake aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'rinruby'.
/home/jerviver21/workspace_upworkruby/blog1/config/application.rb:7:in `<top (required)>'
/home/jerviver21/workspace_upworkruby/blog1/Rakefile:4:in `<top (required)>'
Errno::ENOENT: No such file or directory - R
/home/jerviver21/workspace_upworkruby/blog1/config/application.rb:7:in `<top (required)>'
/home/jerviver21/workspace_upworkruby/blog1/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
I'm using Ubuntu 14.04, and postgreSQL 9.4.7
This is my Gemfile:
source 'https://rubygems.org'
#Buscar en rubygems.org las implementaciones que se necesiten
#Registro y autenticacion de usuarios
gem 'devise'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.5'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
#rinruby
gem 'rinruby', '~> 2.0.3'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
I just tested installing the rinruby 2.0.3 gem on Ruby 2.4.0-dev.
At first , running require 'rinruby' gave me an error about not having R installed.
So I followed these instructions for installing R on Ubuntu 14.04
After that, the require was successful.

Getting H10 error when trying deploy RoR App at Heroku

Here is Heroku logs
Local everything work just fine
2016-02-21T21:48:36.961997+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails.rb:11:in `<top (required)>'
2016-02-21T21:48:36.961999+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/commands/server.rb:4:in `<top (required)>'
2016-02-21T21:48:36.962004+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:74:in `server'
2016-02-21T21:48:36.962000+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:128:in `require'
2016-02-21T21:48:36.962006+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
2016-02-21T21:48:37.595114+00:00 heroku[web.1]: State changed from starting to crashed
Ruby -v 2.1.5
Rails -v 4.1.8
Gemfile
source 'https://rubygems.org'
ruby '2.1.5'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails', '~> 3.0'
gem 'factory_girl_rails', '~> 4.0'
gem 'guard'
gem 'guard-rspec', require: false
gem 'spork-rails'
gem 'guard-spork'
gem 'wdm'
end
gem 'active_link_to'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'will_paginate', '~> 3.0.6'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
group :production do
gem 'rails_12factor'
gem 'pg'
end
gem 'devise'
gem 'cancancan'
gem 'stripe'
gem 'jruby-openssl'
gem 'highline', '~> 1.7', '>= 1.7.8'
gem 'byebug'
gem 'brakeman'
I'm new for Ror, So any help will be great
Working from Windows
StackOverflow asking me to add more details, but I have no idea what to add here, so I'm just writing this text
You certainly resently switch from sqlite to pg.
[heroku doc sayz] A crashed web dyno or a boot timeout on the web dyno will present this error.
Sqlite is a "dummy" db , it's permissive as hell you may have make tiny mistakes here and there , is it workin with pg locally?

RoR 4 error after bundle update

I'm getting following error in all models in my project when calling method ".create":
NoMethodError: undefined method `[]' for nil:NilClass
from /home/pavelkhrulev/.rvm/gems/ruby-2.0.0-p195#spasibo/bundler/gems/rails-b52b0bebd147/activerecord/lib/active_record/attribute_methods/read.rb:86:in `block in read_attribute'
from /home/pavelkhrulev/.rvm/gems/ruby-2.0.0-p195#spasibo/bundler/gems/rails-b52b0bebd147/activerecord/lib/active_record/attribute_methods/read.rb:84:in `fetch'
from /home/pavelkhrulev/.rvm/gems/ruby-2.0.0-p195#spasibo/bundler/gems/rails-b52b0bebd147/activerecord/lib/active_record/attribute_methods/read.rb:84:in `read_attribute'
from /home/pavelkhrulev/.rvm/gems/ruby-2.0.0-p195#spasibo/bundler/gems/rails-b52b0bebd147/activerecord/lib/active_record/attribute_methods/primary_key.rb:19:in `id'
from /home/pavelkhrulev/.rvm/gems/ruby-2.0.0-p195#spasibo/bundler/gems/rails-b52b0bebd147/activerecord/lib/active_record/transactions.rb:341:in `remember_transaction_record_state'
from /home/pavelkhrulev/.rvm/gems/ruby-2.0.0-p195#spasibo/bundler/gems/rails-b52b0bebd147/activerecord/lib/active_record/transactions.rb:280:in `rollback_active_record_state!'
from /home/pavelkhrulev/.rvm/gems/ruby-2.0.0-p195#spasibo/bundler/gems/rails-b52b0bebd147/activerecord/lib/active_record/transactions.rb:269:in `save'
from /home/pavelkhrulev/.rvm/gems/ruby-2.0.0-p195#spasibo/gems/protected_attributes-1.0.3/lib/active_record/mass_assignment_security/persistence.rb:46:in `create'
from (irb):1
from /home/pavelkhrulev/.rvm/gems/ruby-2.0.0-p195#spasibo/bundler/gems/rails-b52b0bebd147/railties/lib/rails/commands/console.rb:90:in `start'
from /home/pavelkhrulev/.rvm/gems/ruby-2.0.0-p195#spasibo/bundler/gems/rails-b52b0bebd147/railties/lib/rails/commands/console.rb:9:in `start'
from /home/pavelkhrulev/.rvm/gems/ruby-2.0.0-p195#spasibo/bundler/gems/rails-b52b0bebd147/railties/lib/rails/commands.rb:62:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Everything was working before, but i made bundle update and now it's not.
My gemfile:
ruby '2.0.0'
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', git: 'https://github.com/rails/rails.git', branch: '4-0-stable'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', git: 'https://github.com/rails/sass-rails.git'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', git: 'git://github.com/rails/coffee-rails.git'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
group :production do
gem 'therubyracer', platforms: :ruby
end
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'jquery-turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Use heroku gem to make all features enabled
gem 'rails_12factor', group: :production
# New Relic perfomance monitor
gem 'newrelic_rpm'
# Application gems
gem "devise", :git => "http://github.com/plataformatec/devise.git"
gem 'protected_attributes'
gem 'russian'
gem 'devise-russian'
gem 'kaminari'
# Admin panel
gem 'activeadmin', github: 'gregbell/active_admin', branch: 'rails4'
gem 'ransack'
gem 'inherited_resources', github: 'josevalim/inherited_resources'
gem 'formtastic', github: 'justinfrench/formtastic'
I looked at the source code, used the google search, but still have no idea how to fix this. I will appreciate any help. I really stuck with it. I need to delivery project that was almost finished.
Ensure that your proteced_attributes gem is updated to the latest version. This rails issue acknowledges there was a compatibility bug.
in Gemfile can you please try
gem 'rails', '~> 4.0.0'
instead of
gem 'rails', git: 'https://github.com/rails/rails.git', branch: '4-0-stable'
then bundle install
*Edit: added comma in first statement

Resources