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'
Related
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..!
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
I have a rails app with foundation 6 gem that renders well locally, but as soon that I push to a dokku server, the layout is not rendered.
On the chrome devlopper console I find the following error:
Uncaught ReferenceError: $ is not defined
My Gemfile
source 'https://rubygems.org'
gem 'rails_12factor', group: :production
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# 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
#CMS
gem 'comfortable_mexican_sofa', '~> 1.12.0'
gem 'comfy_blog', '~> 1.12.0'
#foundation
gem 'foundation_rails_helper'
gem 'foundation-rails', github: "zurb/foundation-rails"
gem 'foundation-icons-sass-rails'
# 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 'puma'
# 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 :production do
gem 'pg'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
ruby "2.2.2"
EDIT:
I've realised that locally the application.erb.html is inserted, but on dokku it's not.
Make sure that the assets are precompiled. In the production environment 'rake assets:precompile' has to run through before the rails server is started.
Whenever i try to access my rails app when it's running on localhost, I get the error:
File to import not found or unreadable: foundation/functions.
Load paths:
/home/oscar/RubymineProjects/myapp/app/assets/images
/home/oscar/RubymineProjects/myapp/app/assets/javascripts
/home/oscar/RubymineProjects/myapp/app/assets/stylesheets
/home/oscar/RubymineProjects/myapp/vendor/assets/javascripts
/home/oscar/RubymineProjects/myapp/vendor/assets/stylesheets
/var/lib/gems/2.1.0/gems/jquery-rails-4.1.0/vendor/assets/javascripts
/var/lib/gems/2.1.0/gems/coffee-rails-4.1.1/lib/assets/javascripts
/var/lib/gems/2.1.0/gems/foundation-rails-6.1.2.0/vendor/assets/js
/var/lib/gems/2.1.0/gems/foundation-rails-6.1.2.0/vendor/assets/scss
/var/lib/gems/2.1.0/gems/cocoon-1.2.7/app/assets/javascripts
I have tried fixing this using every method I could find in similar questions, but to no avail. Here is my Gemfile:
source 'https://rubygems.org'
gem 'foundation_rails_helper'
gem 'cocoon'
gem 'devise'
gem 'foundation-rails'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0.4'
# 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
# Use jquery as the JavaScript library
gem 'jquery-rails'
## 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 'remove_turbolinks'
# 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'
gem 'better_errors'
end
Any advice or suggestions would be appreciated.
In my rails app, activemessaing caused an infinite loop, e.g. when I run bundle install, an error message is given:
"Your Gemfile requires gems that depend on each other, creating an infinite loop. Please remove gem 'activemessaging' and try again."
Any ideas?
Gemfile
source 'https://rubygems.org'
#gem 'dotenv-rails', :groups => [:development, :test]
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# 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
# 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
gem 'bootstrap-sass', '3.2.0.0'
gem 'rails_config'
gem 'nokogiri-pretty'
gem 'dotenv-rails'
gem 'devise'
gem 'devise_ldap_authenticatable'
gem "activemessaging"
gem 'stomp'
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'
end
gem 'daemons'
As the message suggests, the problem is caused by the infinite loop dependency, e.g. activemessaging depends on itself. Check the gem spec in activemessaging to see if there is a self dependency defined.
I managed to get it fixed.
Just refer activemessaging to my forked version:
gem "activemessaging", :git => "https://github.com/digital-york/activemessaging.git"
The changes I've made is just to comment out self dependencies in the gem spec.