I'm trying to implement pagination in my Rails app with the neo4j-will_paginate gem (I'm using neo4j as my database.) I followed the instructions at https://github.com/dnagir/neo4j-will_paginate#readme viz. added neo4j-will_paginate to my gemfile and required 'neo4j-will_paginate' in my config/application.rb file. I ran bundle install and tried to fire up Rails, but I got this error:
NameError: uninitialized constant Neo4j::Traversal
const_missing at org/jruby/RubyModule.java:2642
(root) at /Users/--------/.rvm/gems/jruby-1.6.7/gems/neo4j-will_paginate-0.1.0/lib/neo4j-will_paginate.rb:43
require at org/jruby/RubyKernel.java:1042
(root) at /Users/--------/.rvm/gems/jruby-1.6.7/gems/neo4j-will_paginate-0.1.0/lib/neo4j-will_paginate.rb:12
require at org/jruby/RubyKernel.java:1042
(root) at /Users/--------/Documents/code/ThreeRing/threering/config/application.rb:53
tap at org/jruby/RubyKernel.java:1787
(root) at /Users/--------/.rvm/gems/jruby-1.6.7/gems/railties-3.2.3/lib/rails/commands.rb:50
require at org/jruby/RubyKernel.java:1042
(root) at script/rails:6
Here's my Gemfile and the relevent part of my config/application.rb
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
require "neo4j"
# require "will_paginate/railtie"
require 'neo4j-will_paginate'
Here's the gemfile
source 'http://rubygems.org'
gem 'rails', '3.2.3'
gem 'neo4j', '~> 2.0.0'
gem 'jruby-openssl', '~> 0.7.7'
gem 'json', '~> 1.7.3'
gem 'jquery-rails', ' ~> 2.0.2'
gem 'haml-rails', '~> 0.3.4'
gem 'bcrypt-ruby', '~> 3.0.1', :require => 'bcrypt'
# gem 'will_paginate', ' ~> 3.0.3'
gem 'neo4j-will_paginate'
gem 'carrierwave', '~> 0.6.2'
gem 'fog', '~> 1.3.1'
gem 'mini_magick', '~> 3.4'
gem 'trinidad', '~> 1.3.5', :require => nil
gem 'nokogiri'
gem 'libxml-jruby'
gem 'sanitize'
group :development do
gem 'rspec-rails', '~> 2.10.0'
gem 'guard-rspec', '~> 1.0.0'
end
group :test do
gem 'factory_girl_rails', '~> 3.3.0'
gem 'spork', ' ~> 1.0rc'
gem 'rb-fsevent', '~> 0.9.1'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.0'
gem 'therubyrhino', '~> 1.73.4'
gem 'uglifier', '>= 1.0.3'
end
Googling the error turns up no help, and I haven't seen any similar problems whose solutions are applicable here. Any ideas of what's going wrong here? Thanks!
It is because version < 0.1.2 of neo4j-will-paginate does not work together with neo4j.rb version 2+
Try version 0.1.2 which was released today.
Related
I am using rails 5.2.3 and ruby 2.5.2 version , In my work i have two active job classes that will perform two jobs parallel , I am using MSSQL database and having "No connection pool with 'primary' found" issue when it started working in parallel .
Can anyone help me to resolve this .
#source 'https://rubygems.org'
source 'http://production.cf.rubygems.org'
#source 'http://rubygems.org'
gem 'rails', '5.2.3'
gem 'log4r'
gem 'will_paginate'
gem 'bcrypt'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'activesupport'
gem 'activerecord-sqlserver-adapter'
gem 'tiny_tds'
gem 'sequel'
gem 'mysql2', '~> 0.5.2 '
gem 'bootsnap'
gem 'capybara'
gem 'poltergeist', :group => [:development, :test]
gem "rspec-rails", :group => [:development, :test]
gem 'public_suffix'
gem 'xpath'
gem 'nokogiri'
gem 'byebug', '~> 11.1', '>= 11.1.1'
gem 'activewarehouse-etl', '~> 1.0'
gem 'table_print'
gem 'sidekiq'
#gem 'pg'
gem 'adapter_extensions', '~> 0.9.5.rc1'
gem 'test-unit'
gem "iconv", "~> 1.0.3"
gem 'fileutils'
gem 'json'
# Gems used only for assets and not required
# in production environments by default.
gem 'stupidedi'
gem 'sass-rails'
gem 'sass'
gem 'coffee-rails'
gem 'mailfactory'
gem 'rake'
gem 'rack-cache'
gem 'listen'
gem 'thor'
gem 'openssl'
gem 'rb-inotify'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyrhino'
gem 'uglifier'
group :assets do
end
gem 'rubyzip', '>= 1.0.0'
gem 'axlsx'
gem "axlsx_rails"
gem 'prawn'
gem 'typhoeus'
gem 'tlsmail'
gem 'net_http_ssl_fix'
gem 'simple_xlsx_reader'
gem 'spreadsheet'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
I have installed a gem rspec-rails. Everything is working fine except ActiveJob.
I have tried to implement the ActiveJob in RSpec with:
include ActiveJob::TestHelper
and here's the code for the RSsec Job Controller:
describe "#perform_later" do
it "Send Invoice Reminder" do
ActiveJob::Base.queue_adapter = :test
InvoiceReminderJob.perform_later
expect(InvoiceReminderJob).to have_enqueued_job
end
end
spec_helper.rb:
require 'rails_helper'
RSpec.describe InvoiceReminderJob, type: :job do
include ActiveJob::TestHelper
# pending "add some examples to (or delete) #{__FILE__}"
describe "#perform_later" do
it "Send Invoice Reminder" do
ActiveJob::Base.queue_adapter = :test
InvoiceReminderJob.perform("test")
expect(InvoiceReminderJob).to have_enqueued_job
end
end
end
invoice_reminder_job_spec.rb:
require 'rails_helper'
RSpec.describe InvoiceReminderJob, type: :job do
# include ActiveJob::TestHelper
# pending "add some examples to (or delete) #{__FILE__}"
describe "#perform_later" do
it "Send Invoice Reminder" do
ActiveJob::Base.queue_adapter = :test
InvoiceReminderJob.perform_later
expect(InvoiceReminderJob).to have_enqueued_job
end
end
end
When I am trying to run rspec with the command rspec I am getting the following error:
uninitialized constant ActiveJob (NameError)
Here is my Gemfile:
Here is the gemfile included for my project:
source 'https://rubygems.org'
ruby '2.1.2'
gem 'acts-as-taggable-on', '~> 3.4'
gem 'acts_as_tenant'
gem 'audited', '~> 4.0'
gem 'audited-activerecord'
gem 'aws-sdk', '~> 1.6'
gem 'axlsx'
gem 'best_in_place', '~> 3.0.1'
gem 'bootstrap-generators'
gem 'bootstrap-sass'
gem 'bullet', group: 'development'
gem 'cancancan', '~> 1.10'
gem 'clockwork'
gem 'coffee-rails', '~> 4.1.0'
gem 'daemons'
gem 'delayed_job_active_record'
gem 'devise'
gem 'eefgilm'
gem 'exception_notification'
gem 'figaro'
gem 'font-awesome-rails'
gem 'i18n-js', '>= 3.0.0.rc11'
gem 'jbuilder', '~> 2.0'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'mailman'
gem 'net-ssh'
gem 'paperclip', '~> 4.2'
gem 'pg'
gem 'protected_attributes'
gem 'puma'
gem 'rails', '4.1.5'
gem 'rails-console-tweaks'
gem 'rails-i18n'
gem 'rails_best_practices'
gem 'redcarpet'
gem 'rest-client'
gem 'roo'
gem 'roo-google'
gem 'roo-xls'
gem 'rubocop', require: false
gem 'sass-rails', '~> 5.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'seed_dump'
gem 'simple_form'
gem 'therubyracer', platforms: :ruby
gem 'traceroute'
gem 'twitter-bootstrap-rails'
gem 'uglifier', '>= 1.3.0'
gem 'whenever', :require => false
gem 'wicked_pdf'
gem 'wkhtmltopdf-binary'
gem 'zip'
group :development do
gem 'capistrano'
gem 'capistrano3-puma'
gem 'capistrano-bundler', require: false
gem 'capistrano-rails', require: false
gem 'capistrano-rvm'
gem 'rails-erd'
gem 'capistrano-rails-console', require: false
gem 'capistrano-maintenance', '~> 1.0', require: false
gem 'letter_opener'
gem 'rspec-rails'
gem 'faker'
end
group :production do
gem 'rails_12factor'
end
group :test do
gem 'shoulda-matchers'
gem 'database_cleaner'
gem 'simplecov'
end
group :development, :test do
gem 'byebug'
gem 'hirb'
gem 'mocha'
gem 'activejob'
gem 'factory_bot_rails'
end
And here is the output of bundle show activejob:
/Users/221/.rvm/gems/ruby-2.1.2/gems/activejob-0
I have tried to search with lots of solution but I am not able to resolve this issue. If anyone could help me with it, I would be really grateful.
You are using rails 4.1.5, ActiveJob is introduced in rails 4.2
This issue is resolved by using the gem "gem 'activejob_backport'
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
Everytime I run a heroku command I receive this error:
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.2
This has been happening since I pushed several changes (adding sidekiq and making changes to my clock.rb file, also: a new model I need to migrate the db for)
Does anyone know why this might be happening? It only started after I added ruby '2.1.2' to the gemfile. But before that I was getting this funky segmentation fault error.
Here's my gemfile:
source 'https://rubygems.org'
ruby '2.1.2'
gem 'rails', '4.1.1'
gem 'pg'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'clockwork'
gem 'httparty'
gem 'omniauth-facebook'
gem 'parse-ruby-client'
gem 'parse_resource', '~> 1.8.0'
gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'
gem 'sidekiq'
gem 'foundation-rails'
group :development, :test do
gem 'pry-rails'
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'shoulda-matchers'
gem 'valid_attribute'
gem 'capybara'
gem 'dotenv-rails'
gem 'better_errors'
gem 'binding_of_caller'
end
group :production do
gem 'rails_12factor'
gem 'thin'
end
It's seems to related bundler issue. Go through here https://github.com/sstephenson/rbenv/issues/400 same sort of issue also here get fixed with :
# Rakefile
task :freedom do
Bundler.with_clean_env { sh "heroku" }
end
Hope this help you!
I had two applications using Ruby. In your terminal, change to the directory of the application, then check the Ruby version you are using. Update it appropriately.
I'm upgrading my app from 3.0.9 to 3.2.1 (ruby 1.9.3-p0, rvm, bundler) and one thing that I haven't been able to track down yet is this problem. I have a controller spec (in spec/controllers) that renders views for each example. The template that it renders can have any undefined method (like calling "- blahblah" in the haml) and it causes the test to hang for over 30 seconds. Here is the error:
undefined local variable or method `blahblahblah' for #<#<Class:0x007fa84f76cc90>:0x007fa849c578c8>
I ran the debugger and the hang happened when trying to log the error itself. This happens in activesupport-3.2.1/lib/active_support/notifications/instrumenter.rb line 22. So is this Rails' fault, haml's fault, or some other library?
Here is my Gemfile just in case something I am using may be the problem:
source 'http://rubygems.org'
source 'http://gems.github.com'
source 'http://gemcutter.org'
gem 'rails', '3.2.1'
gem 'rake', '~> 0.9.2.2'
gem 'mysql2', '~> 0.3.11'
gem 'htmldoc'
gem 'haml', '~> 3.1.4'
gem 'sass', '~> 3.1.4'
gem 'hpricot'
gem 'curb'
gem 'mini_magick'
gem 'liquid', '~> 2.3.0'
gem 'httparty', '~> 0.8.1'
gem 'linkedin', '0.1.7', :require => 'linkedin'
gem 'twitter', '~> 2.0.2', :require => 'twitter'
gem 'mime-types', '>=1.16', :require => 'mime/types'
gem 'oauth'
gem 'roxml'
gem 'nokogiri'
gem 'sax-machine'
gem 'googlecharts', '1.6.7', :require => 'gchart'
gem 'pdf-reader', '~> 0.9.0'
gem 'paper_trail'
gem 'rubyzip', '0.9.4', :require => 'zip/zip'
gem 'activemerchant', '~> 1.20.2', :require => 'active_merchant'
gem 'compass', '~> 0.11.5'
gem 'compass-rgbapng', '0.1.1', :require => 'rgbapng'
gem 'fancy-buttons', '~> 1.1.1'
gem 'ruby-openid'
gem 'RedCloth', '~> 4.2.9'
gem 'koala', '~> 1.0.0'
gem 'scoped_search', '~> 2.3.6'
gem 'wicked_pdf', '0.7.0'
gem 'devise', '~> 2.0.0'
gem 'paperclip', '~> 2.5.0'
gem 'aws-sdk' # required for paperclip
gem 'whois', '~> 2.0.4'
gem 'validates_timeliness', '~> 3.0.8'
gem 'will_paginate', '~> 3.0.2'
gem 'hoptoad_notifier', '~> 2.4.11'
gem 'savon', '~> 0.9.2'
gem 'escape_utils'
gem 'ajaxful_rating', '3.0.0.beta3'
gem 'acts_as_list', '~> 0.1.3'
gem 'despamilator', '~> 2.0'
gem 'prawn', '~> 0.12.0', :submodules => true
gem 'net-dns', '~> 0.6.1'
gem 'authlogic', '~> 3.1.0'
gem 'myspaceid-sdk', '~> 0.1.11', :require => 'myspace'
gem 'in_place_editing', '~> 1.1.2'
gem 'deadlock_retry', '~> 1.1.2'
gem 'query_trace', '~> 0.1.1'
gem 'aasm', '~> 3.0.2'
gem 'vanity', '~> 1.7.1'
gem 'prototype-rails', '~> 3.2.1'
group :development, :test do
gem 'rspec-rails', '~> 2.8.1'
gem 'rspec'
# one-liner to install these properly: bash < <(curl -L https://raw.github.com/gist/1333785)
gem 'linecache19', '0.5.13'
gem 'ruby-debug-base19', '0.11.26'
gem 'capistrano'
end
group :test do
gem 'factory_girl_rails'
gem 'syntax'
gem 'timecop', '~> 0.3.5'
gem 'capybara'
gem 'database_cleaner'
gem 'cucumber-rails', '~> 1.2.1'
gem 'cucumber'
gem 'launchy'
end
Thanks!
I found the answer to this in the Rails issue tracker on Github (it's still an open bug as of this time). The problem turned out to be that when an error was raised, an instance of ActionDispatch::Routing::RouteSet was inspected, which apparently caused the object to inspect every item it was holding onto. So, the larger the RouteSet, the longer the #inspect took. Here is the fix:
module ActionDispatch
module Routing
class RouteSet
alias inspect to_s
end
end
end
For more info on the bug, see here.