When I am running add migrations, i am facing the following issue:
raj#itadmin-HP-Pavilion-17-Notebook-PC:~/Desktop/Projects/invoicemanagement$ rails g migration add_avatars_to_invoice_details avatars:string
Warning: You're using Rubygems 1.8.23 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:33:in `block in setup': You have already activated spring 1.3.3, but your Gemfile requires spring 1.3.2. Using bundle exec may solve this. (Gem::LoadError)
from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:19:in `setup'
from /usr/lib/ruby/vendor_ruby/bundler.rb:120:in `setup'
from /usr/lib/ruby/vendor_ruby/bundler/setup.rb:7:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/commands.rb:33:in `<module:Spring>'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/commands.rb:4:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/server.rb:9:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
and my Gemfile :
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.4'
#gem 'therubyracer' , '0.12.1', :platforms => :ruby
# Use sqlite3 as the database for Active Record
gem 'sqlite3', :group => [:development, :test]
group :production do
# gem 'thin'
gem 'pg'
end
# 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
# 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]
gem 'devise'
gem "therubyracer"
gem "less-rails"
gem "twitter-bootstrap-rails"
gem 'carrierwave', '~> 0.9'
gem 'bootstrap-sass', '~> 2.3.2'
gem 'prawn'
gem 'prawnto'
gem 'carmen-rails', '~> 1.0.0'
gem 'jquery-datatables-rails', '~> 3.0.0'
gem 'haml', '~> 4.0.5'
gem 'simple_form'
Previously, the migrations are running fine and I also tried using bundle exec before the add migratiion commmeand, but I found no luck.
Please let me know, where I went wrong.
Thanks in advance.
Spring was updated 20 days ago
Try bundle update spring to try fix this problem. This would not only just update your gem, but also update dependencies.
As the message states, you need to update your version of Rubygems, and then run gem pristine --all.
You can update Rubygems by running gem update --system.
Once you've done that, then you can start looking at prefixing your commands with bundle exec.
Related
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.
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.
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?
Does anyone has any idea why bundler is throwing this error.
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler/source/rubygems.rb:158:in `normalize_uri': The source must be an absolute URI (ArgumentError)
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler/source/rubygems.rb:129:in `add_remote'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler/dsl.rb:121:in `source'
/home/arrc/arrC/rails/Gemfile:1:in `eval_gemfile'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler/dsl.rb:30:in `instance_eval'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler/dsl.rb:30:in `eval_gemfile'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler/dsl.rb:9:in `evaluate'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler/definition.rb:26:in `build'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler.rb:152:in `definition'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler/cli.rb:255:in `install'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler/vendor/thor/command.rb:27:in `run'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_command'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler/vendor/thor.rb:363:in `dispatch'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler/vendor/thor/base.rb:438:in `start'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler/cli.rb:10:in `start'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/bin/bundle:22:in `block in <main>'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
/home/arrc/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.0/bin/bundle:22:in `<main>'
There was an error in your Gemfile, and Bundler cannot continue.
I thought this error was version specific so i uninstalled bundler 1.5.0 but I'm still getting this same error in version 1.3.5 (bundler).
Standard rails 4.0.2 generated Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.2'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# 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 .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', '~> 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.1.2'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
Try to remove indent in your first line of Gemfile, otherwise create an issue in Bundler github repository.
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