I am currently using Rails 4.2.5 for my project. In my gemfile, the way I install is :
gem 'awesome_nested_set'
Even though I install successfully, the problem is happened in the server.
Error:
undefined local variable or method `acts_as_nested_set'
only at production environment.
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'mysql2', '0.3.18'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
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'
gem 'awesome_nested_set', '3.0.2'
gem 'jquery-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
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'bcrypt', '~> 3.1.7'
gem 'devise'
gem 'rails_admin'
gem 'rb-readline'
gem 'unicorn'
gem 'capistrano', '>= 3'
gem 'capistrano-bundler'
gem 'capistrano-rbenv', github: "capistrano/rbenv"
gem 'capistrano-rails'
gem 'omniauth'
gem 'omniauth-facebook'
gem 'omniauth-oauth2', '~> 1.3.1'
# Use Unicorn as the app server
# gem 'unicorn'
gem 'wicked'
gem 'kaminari'
gem "simple_calendar", "~> 2.0"
gem 'bootstrap-sass'
gem 'chosen-rails'
gem 'mailboxer'
gem 'webpay'
gem 'unicorn'
gem 'gretel'
gem 'sitemap_generator'
gem 'stripe'
gem 'carrierwave'
gem 'rmagick'
gem 'i18n_generators'
# 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'
gem 'pry-rails'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
# gem 'spring'
end
[]# bundle show 'awesome_nested_set'
/usr/local/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/awesome_nested_set-3.1.1
It's in there..!
Related
Below is my Gemfile but i haven't specified the mysql2 version but for some reason it's looking for 0.4.4. It must be a dependency of another gem. I was just assigned thAny ideas?
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'mysql2', group: :production
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# 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 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'
gem 'active_model_serializers', '~> 0.10.0.rc5'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'acts_as_better_tree'
gem 'rest-client', '~> 1.8'
gem 'apipie-rails', :github => 'Apipie/apipie-rails'
gem 'devise'
gem 'petergate'
gem 'pry-rails'
gem 'annotate'
gem 'slim-rails'
gem 'bootstrap-sass'
gem 'font-awesome-sass'
gem 'carrierwave'
gem 'carrierwave-base64'
gem 'carrierwave-aws'
gem 'authorizenet'
gem 'figaro'
gem 'roo', '~> 2.3.2'
gem 'roo-xls', '~> 1.0'
gem 'mini_magick', '~> 4.5'
gem 'html5shiv-rails'
gem 'cocoon'
gem 'will_paginate'
gem 'wicked_pdf'
gem 'wkhtmltopdf_binary'
gem "minitest-rails"
gem "minitest-reporters"
gem 'airbrake', '~> 5.6'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'capistrano'
gem 'capistrano-passenger'
gem 'capistrano-bundler'
gem 'capistrano-rails'
gem 'capistrano-rails-console'
gem 'capistrano-rvm'
gem 'better_errors'
gem 'pry'
end
group :development, :test do
gem 'sqlite3'
gem 'byebug'
end
$ gem dependency mysql2 --reverse-dependencies
It'll list each version of mysql2 and then the gems that depend on that version.
I believe the problem is with the rails version and mysql2 version. Change the Gemfile line that contains gem 'mysql2' to gem 'mysql2', '~> 0.4.0'
I have gem 'rails', '4.2.6' installed but apparently there is some compile error with mysql2 and that version of rails.
"For Rails 4.x please pin the gem to mysql2 '~> 0.4.0'" - sodabrew
After doing this the bundle install ran and I was able to run rails c without errors.
I want to know what is the best to set up postgres in c9 in order to deploy to heroku.
I follow this https://www.codecademy.com/articles/deploy-rails-to-heroku it worked on a test app but it didn't push the code to heroku on the main app!
I am really afraid that by working around with the database, I would mess up the app.
Please help and thanks in advance!
Edit!!
I followed the first answer of this post Cloud9 postgres and i got the error.
here my gem file:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'pg', '~> 0.18.2'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assetsbu
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# 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 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'
gem 'haml', '~> 4.0', '>= 4.0.7'
gem 'simple_form', '~> 3.3', '>= 3.3.1'
gem 'devise', '~> 4.2'
gem 'paperclip', '~> 5.1'
gem 'acts_as_votable', '~> 0.10.0'
gem 'rails-i18n', '~> 4.0', '>= 4.0.8'
gem 'css_convertor', '~> 1.0', '>= 1.0.3'
gem 'bootstrap-sass', '~> 3.3', '>= 3.3.7'
gem 'autoprefixer-rails'
gem 'rails_admin', '~> 1.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# 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
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
I see many answers for this error when ruby version is =>2.2, but in my computer installed ruby version is [ruby 2.1.8p440]
I get this error when starting a server ( rails server ).
Gemfile
source 'http://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
gem 'pg', '0.18.2'
# Use SCSS for stylesheets
#gem 'sass-rails', '~> 4.0.3'
gem 'rails_12factor', group: :production
# 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
# 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 'sass-rails', '>= 3.3.4'
gem 'bootstrap-sass', '~> 3.3.6'
gem 'ckeditor', '4.1.6'
gem 'carrierwave', '0.10.0'
gem 'fog', '~> 1.3.1'
gem 'mini_magick', '4.5.1'
gem 'will_paginate', '3.1.0'
gem 'nokogiri', '>= 1.5.0'
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
You need to run bundle (or bundle install, but bundle does the same thing), to install the gems that are necessary for the app to run.
I do everything according to Readme but having an issue when starting a rails app: Sprockets::FileNotFound And it points to //= require twitter/bootstrap Does this gem really install bootstrap stylesheets and corresponding js libraries or one is supposed to install them manually (with bower or in another way)?
Here is my Gemfile:
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5.1'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.15'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# 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
# 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
group :assets do
gem 'twitter-bootstrap-rails'
end
gem 'responders', '~> 2.1.1'
gem 'haml'
group :development, :test do
gem 'pry-byebug'
gem 'pry-rails'
gem 'rspec-expectations', '~> 3.0.0'
gem 'spring-commands-rspec'
#gem 'guard-rspec', require: false
gem 'rspec-rails', '~> 3.0.0'
# Support for its syntax
gem 'rspec-its', '~> 1.0.1'
gem 'shoulda-matchers', '~> 3.1.1'
gem 'factory_girl_rails'
gem 'ffaker'
gem "bower-rails", "~> 0.10.0"
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
gem 'haml-rails'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
I'd say that because group assets were dropped in Rails 4. From the docs:
Rails 4.0 removed the assets group from Gemfile. You'd need to remove that line from your Gemfile when upgrading. You should also update your application file (in config/application.rb):
So instead of using it
....
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :assets do
gem 'twitter-bootstrap-rails'
end
....
Just remove the group block:
....
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'twitter-bootstrap-rails'
....
And then run bundle install and restart the server.
More info - Why did Rails4 drop support for “assets” group in the Gemfile
This is my first project in Rails 4, I'm using 4.2
I'm finding that rspec is not reloading my spec files each time it runs, so tests that I've fixed continue to fail with the old error message.
I'm guessing this has something to do with spring but I can't seem to find information on how to configure paths it should reload.
I'm launching rspec using bin/rspec, and here's my Gemfile if that's of use.
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Angular CSRF handling
gem 'angular_rails_csrf'
gem 'pg'
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'jquery-ui-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'
gem 'sass', '3.2.19'
group :test, :development do
gem "factory_girl_rails", "~> 4.0"
gem "capybara"
gem "database_cleaner"
gem "selenium-webdriver"
gem "teaspoon-jasmine"
gem 'teaspoon'
gem 'phantomjs'
gem 'guard-teaspoon'
gem 'spring-commands-teaspoon'
gem 'rspec-rails'
gem 'spring-commands-rspec'
gem 'guard-rspec'
gem 'rb-readline'
gem 'rb-fsevent' if `uname` =~ /Darwin/
end
gem 'bootstrap-sass', '~> 3.1.1'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bson_ext', '~> 1.8.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
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', '1.3.6'
end
# Preload angular templates
gem 'angular-rails-templates'