Error:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/devise-1.0.11/lib/devise.rb:89:in '': undefined method 'weeks' for 2:Fixnum (NoMethodError)
That error is thrown whenever I try to run 'rails g devise:install' in a rails project I've been working on.
Any ideas?
P.S. requiring gem 'devise' in Gemfile and running bundle install to get the devise gem
This issue was already dealt with here. Try updating to a later devise version to fix.
Related
I am getting above error while set up gem config in my application. The error only comes in production.
It is working fine on my local.
I am getting the error in Config.setup do |config|
My Ruby version is 2.4 and rails version is 5.0
I am using Unicorn as my application server
Error = E, [2018-07-30T10:01:57.579983 #6128] ERROR -- : undefined methodsetup' for Config:Module (NoMethodError)`
Try changing the source of gem to the latest location in your gemfile as below:
gem 'config', github: 'railsconfig/config'
Hope this helps !!!
I have fixed the above problem by upgrading the Rails version from 5.0 to Rails 5.1.6
It was working on local because in my local machine Rails 5.1 was already installed. It was a Rails versioning problem.
I started learning Ember.js using Rails as back-end, and created a test project. So, first I removed turbolinks from app and added the following gems to Gemfile:
gem 'ember-rails'
gem 'ember-source', '~> 1.8.1'
gem 'emblem-rails'
and bundled them. Next, I ran
$ rails g ember:bootstrap -n App --javascript-engine js
and it has returned me the following error:
/home/alex/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/emblem-rails-0.2.2/lib/emblem/rails/engine.rb:7:in
`block in <class:Engine>':
undefined method `register_engine' for nil:NilClass (NoMethodError)
Is the problem that something can be deprecated? I'm following the tutorial written in 2014.
The trouble was caused by emblem-rails gem - I commented it out, and everything worked
When using kaminari with mongoid, I get the error
undefined method `page' for #<Mongoid::Contextual::Mongo:0x007fe48c195af0>
Not sure what is wrong. I even tried running
Item.page(params[:page])
and I get the error
NoMethodError: undefined method `page' for Item:Class
The gem is present in the Gemfile. Double checked.
I see you are using mongoid, in that case add to the Gemfile will_paginate_mongoid gem and run $ bundle
More info can be found here and here.
I'm learning Rails with the awesome Ruby on Rails Tutorial by Michael Hartl. I'm on section 3.2.2 (Test Driven Development) in which I need to run the following command to run the rspec tests for my Rails project:
bundle exec rspec spec/
But it doesn't work. Instead I get this error:
/Users/mh/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/
activerecord-3.1.3/lib/active_record/base.rb:1088:in `method_missing':
undefined method `mass_assignment_sanitizer=' for
ActiveRecord::Base:Class (NoMethodError)
I've tried reinstalling rspec and changing my Gemfile, but nothing appeases the undefined method error!
Did you downgrade from Rails 3.2 RC1? Comment out the following two lines from your development.rb:
config.active_record.mass_assignment_sanitizer = :strict
config.active_record.auto_explain_threshold_in_seconds = 0.5
While m818's answer will solve the problem, you might still get errors if you are tyring to use deprecated methods elsewhere in your code.
I had the same problem, commenting out those lines got rid of some errors, but not all of them, anywhere I was using attr_accessible gave me the same error.
It turned out to be the `active_record' gem that was updated to 4.0 when I didn't want it to. Since I'm using a Padrino app, I had to do this in the Gemfile:
gem 'activerecord', '= 3.2.12', :require => "active_record"
That solved all issues and I didn't have to comment out the lines in database.rb.
I'm trying to get Devise working. I'm following this tutorial which tells me to do "rails generate devise User" but when I do that command, it gives me an error saying
"NameError: uninitialized constant User from /var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'"
What am I doing wrong? I'm using Rails 3.0.9, Ruby 1.8.7 and Ubuntu 11.04
Thanks a bunch in advance,
Michael.
Do you have gem devise in your Gemfile? Then, run bundle install. You can also try putting require 'devise' in your config/application.rb file (but you shouldn't have to do this).