ActionView::Template::Error (couldn't find file ) - ruby-on-rails

I've updated my app to rails 5.1 and spree to spree 3.5 this caused several problems with the latest being.
ActionView::Template::Error (couldn't find file 'jquery.validate/jquery.validate.min' with type 'application/javascript'
I've tried installing the gems like gem 'jquery-rails' gem 'rails-ujs,'~> 0.1.0' gem "jquery-ui-rails" gem 'jquery-validation-rails' and even added the files to my JavaScript folder.
Still no succes.
Anyone know the cause of the problem and how to solve it?
gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails'
# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
gem 'pg', '< 1'
# Use SCSS for stylesheets
gem 'sass-rails'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
gem 'truncate_html', '~> 0.9.3'
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'rails-ujs', '~> 0.1.0'
gem "jquery-ui-rails"
gem 'jquery-validation-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'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', group: :doc
gem 'rake'
gem 'rspec'
gem 'kramdown'
gem 'thor', '0.19.1'
gem 'spree_braintree_vzero', github: 'spree-contrib/spree_braintree_vzero'
# 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'
gem 'capistrano-passenger'
gem 'capistrano-rails'
gem 'capistrano-rvm'
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
gem 'spree', '~> 3.5.0.rc2'
gem 'spree_auth_devise', '~> 3.3'
gem 'spree_gateway', '~> 3.3'
gem 'devise'
gem 'materialize-sass'
gem 'active_link_to'
#gem 'mollie-api-ruby', '< 3.2'
# gem 'spree_mollie', github: 'salman15/mollie_spree_2017', branch: 'stable'
#gem 'spree_mollie', github: 'ttcremers/spree_mollie', branch: 'stable'
gem 'spree_mail_settings', github: 'spree-contrib/spree_mail_settings'
# gem 'spree_i18n', github: 'spree-contrib/spree_i18n'
# gem 'spree_globalize', github: 'spree-contrib/spree_globalize', branch: 'master'
gem "mini_magick"
gem 'spree_mollie_gateway'
# gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'rails-4-x' # For 4.x
# gem 'globalize', '~> 5.1.0'
all.js/application.js
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require jquery.validate
//= require spree/frontend
//= require_tree .
//= require spree/frontend/spree_auth
//= require spree/frontend/spree_braintree_vzero

This fixed the problem for me: I just removed the line
//= require jquery.validate/jquery.validate.min
from frontend.js

Related

bundle install gemspec error spree_social.gemspec

In my app when I am running bundle install, I am getting below error.
vendor/gems/spree_social/spree_social.gemspec
is not valid. Please fix this gemspec.
The validation error was 'spree_social-3.1.0.beta contains itself
(spree_social-3.1.0.beta.gem), check your files list'
I tried everything like removing the Gemlock and updating the gems. It didn't work.
Below is my Gemfile
source 'https://rubygems.org'
ruby '2.3.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'font-awesome-sass', '~> 4.5.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/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'roo-xls'
# 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 'aws-sdk', '< 2.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'paperclip'
# Use Unicorn as the app server
# gem 'unicorn'
gem 'rails_12factor', group: :production
# 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 'sqlite3'
end
group :production do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'pg'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
gem 'spree_scaffold', github: 'freego/spree_scaffold'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
gem 'spree', '3.0.5'
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '3-0-stable'
gem 'spree_wishlist' , :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_wishlist-2.2.0')
gem 'spree_social', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_social')
gem 'spree_gift_card', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_gift_card')
gem 'stringex'
gem 'spree_reviews', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_reviews')
gem 'spree_auth_devise', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_auth_devise-3.0.6')
gem 'spree_mail_settings', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_mail_settings')
gem 'spree_mail_settings', github: 'spree-contrib/spree_mail_settings', branch: 'master'
Anyone else faced this?
Thanks
This is most likely because your compiled .gem file is contained in the repository. I assume that this is because the gem is trying to package the spree_social-3.1.0.beta.gem file inside itself, and it doesn't like that. Try removing the .gem file from the repository and rerunning bundle install.
I am willing to bet that File.join(File.dirname(__FILE__), '/vendor/gems/spree_social' points to a git repository, where bundle install will compile and install the gem each time you try to run it. My understanding is that when the gem is compiled in this way, it runs git ls-files -z`.split("\x0") on the git repository to get the list of files to put in the gem. Since the .gem file appears in the results, it tries to compile it into the gem, which causes it to fail.
I ran into this issue today, where my Gemfile was pulling a gem from a repository I published to Github, and bundle install kept failing until I removed the .gem file from the repository.

Twitter-bootstrap-rails: does it install Bootstrap into a project?

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

Rake Assets Precompile without Gems in Development or Test Groups

Okay, so I've got an error while building my Docker image (think of it as similar to a deploy step, or Heroku deploy if you're unfamiliar with Docker).
Gems that are in the :test and :development groups are being looked for when the precompile step happens, and since I've bundled --without development test - as I don't want to have QT just so that capybara-webkit doesn't error on bundle - the precompile step is throwing an error.
The error is always a variant of:
Could not find <gem-name> in any of the sources (Bundler::GemNotFound)
My Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.9'
# 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'
gem 'unicorn', '~> 4.8.3'
gem 'unicorn-worker-killer', '~> 0.4.2'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'rdf', '~> 1.1.0'
gem 'tripod', '~> 0.11.1'
gem 'devise'
gem 'devise_invitable'
gem 'authority'
gem 'mongoid', '~> 4.0.0'
gem 'bootstrap-sass', '~> 3.3.3'
# pagination
gem 'kaminari', '~> 0.16.3'
gem 'bootstrap-kaminari-views'
# background processing
gem 'sidekiq'
gem 'sidekiq-status'
gem 'request_store', '~> 1.1.0'
# add memoization
gem 'memoist', '~> 0.12.0'
# dropbox gem for uploads etc
gem 'dropbox-sdk', '~> 1.6.4'
# error reporting
gem 'sentry-raven'
group :development, :test do
gem "rspec-rails", "~> 3.0.0"
gem "factory_girl_rails", "~> 4.5.0"
gem "capybara", "~> 2.4"
gem "database_cleaner"
# gem "selenium-webdriver"
gem 'poltergeist'
gem 'capybara-webkit'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
#gem 'byebug'
gem 'pry-byebug'
gem 'better_errors', '~> 2.1.1'
# 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
The line in the Dockerfile where the error happens is:
RUN /bin/bash -l -c "RAILS_ENV=production bundle exec rake assets:precompile RAILS_GROUPS=assets --trace"
So basically, what I'm really after is the equivalent for --without test development for the rake task. Can I do that? As per some advice, I've already changed (in application.rb):
Bundler.require(*Rails.groups)
to
Bundler.require(:default, :assets, Rails.env)
Anybody have Rails-fu enough to solve this one? I've looked in the docs and on SO, as well as asking my colleagues but I'm still banging my head against the wall over this.
bundle install --path vendor/cache
Try this and let me know if it doesn't work!

Foundation 5 - Rails 4 css topbar not working

I am having an issue with foundation 5, rails 4.1.0, as per screenshot, links are underlined, search box is off.
I have created a separate dummy rails app with the same spec and don't see the same issue
I've tried without turbolinks, and different topbar configurations.
any ideas where to troubleshoot this?
Screenshot:
http://postimg.org/image/ohtwc60rj/
application.js
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require foundation
//= require_tree .
$(function() {
$(document).foundation();
});
`
application.css.scss
*= require_tree .
*= require_self
*/
gemfile
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'
# 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'
gem 'foundation-rails'
gem 'rails_12factor'
gem 'activeadmin', github: 'gregbell/active_admin'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :development do
#gem 'sqlite3'
gem 'rspec-rails'
gem 'guard-rspec'
gem 'slop'
gem 'guard-livereload', require: false
gem 'jazz_hands'
end
gem 'pg', '0.17.1'
group :test do
gem 'rspec-rails'
gem 'capybara'
gem 'rb-fsevent', :require => false
gem 'growl'
gem 'guard-spork', :github => 'guard/guard-spork'
gem 'spork', :github => 'sporkrb/spork'
end
#Server monitoring
gem 'newrelic_rpm'
Found that active admin was conflicting. commented out active_admin.css.scss resolved the issue. That put me in the right direction
Fix from Foundation when using active admin http://foundation.zurb.com/forum/posts/1359-foundation-5-impacted-by-active-admin-on-rails-4

bundle install rails error `parse': Illformed requirement [""] (Gem::Requirement::BadRequirementError)

ran bundle install
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/Users/judyngai/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/requirement.rb:90:in `parse': Illformed requirement [""] (Gem::Requirement::BadRequirementError)
what is the problem with my bundler?
is working in a blank app but just not at the app that I am working on.
thank you
here is my gemfile as requested
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
#High Voltage
gem "high_voltage", "~> 1.2.4"
#Database
gem "pg", "~> 0.16.0"
#to make attribute accessible work
gem "protected_attributes", "~> 1.0.3"
#Authentication , upgrading devise?
gem "devise", "~> 3.0.3"
#Active Admin
gem 'activeadmin', github: 'gregbell/active_admin', branch: 'rails4'
#Simple Form
gem 'simple_form'
#js runting for bootstrap to work
gem "therubyracer"
#Web Server
gem "thin"
#Student Picture Uploaders
gem "rmagick"
gem "carrierwave"
# 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.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]
I don't see any syntax errors in my gemfile. I remember seeing the same error before and removed an extra comma from my gemfile.

Resources