Devise strong params - ruby-on-rails

I am trying to implement devise in one of my rails 4 projects and am getting a weird error. When I run:
rake db:migrate
I get the following:
rake aborted!
NameError: undefined local variable or method `params' for User (call 'User.connection' to establish a connection):Class
/home/zach/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.4/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
/home/zach/HandCoOp/project/HandCo-op/app/models/user.rb:8:in `<class:User>'
/home/zach/HandCoOp/project/HandCo-op/app/models/user.rb:1:in `<top (required)>'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:443:in `load'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:443:in `block in load_file'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:633:in `new_constants_in'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:442:in `load_file'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:342:in `require_or_load'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:480:in `load_missing_constant'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:180:in `const_missing'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:238:in `const_get'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:238:in `block in constantize'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:236:in `each'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:236:in `inject'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:236:in `constantize'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:552:in `get'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:583:in `constantize'
/home/zach/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise.rb:297:in `get'
/home/zach/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/mapping.rb:77:in `to'
/home/zach/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/mapping.rb:72:in `modules'
/home/zach/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/mapping.rb:89:in `routes'
/home/zach/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/mapping.rb:156:in `default_used_route'
/home/zach/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/mapping.rb:66:in `initialize'
/home/zach/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise.rb:331:in `new'
/home/zach/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise.rb:331:in `add_mapping'
/home/zach/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/rails/routes.rb:221:in `block in devise_for'
/home/zach/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/rails/routes.rb:220:in `each'
/home/zach/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/rails/routes.rb:220:in `devise_for'
/home/zach/HandCoOp/project/HandCo-op/config/routes.rb:2:in `block in <top (required)>'
/home/zach/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:337:in `instance_exec'
/home/zach/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:337:in `eval_block'
/home/zach/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:315:in `draw'
/home/zach/HandCoOp/project/HandCo-op/config/routes.rb:1:in `<top (required)>'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `block in load'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `each'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `load_paths'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:16:in `reload!'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:26:in `block in updater'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/file_update_checker.rb:75:in `call'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/file_update_checker.rb:75:in `execute'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:27:in `updater'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/finisher.rb:71:in `block in <module:Finisher>'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `instance_exec'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `run'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:54:in `run_initializers'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application.rb:300:in `initialize!'
/home/zach/HandCoOp/project/HandCo-op/config/environment.rb:5:in `<top (required)>'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `block in require'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
/home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application.rb:276:in `require_environment!'
/home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application.rb:379:in `block in run_tasks_blocks'
/home/zach/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
/home/zach/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
this is my model and the error is pointing to "params.require" which according to strong params, it should be solid.
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :lockable, :timeoutable, :confirmable and :activatable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
params.require(:email, :password, :password_confirmation)
end
Does anyone know what is going on? maybe I am missing a gem required for strong params? I just don't know. I will keep looking into the issue and thank you anyone who knows my mistake.

Did you look how to use strong params? Delete this params.require(:email, :password, :password_confirmation) line from model.
In your controller (assume users_controller.rb):
def create
#user = User.new(user_params)
end
And then at the bottom of a file:
private
def user_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
Defined this in your controller, your create method will be working.

Related

How can I load a custom validator which does not directly inherit from a Rails validator class in Rails 5?

I was writing some custom validators for a Rails 5 project I have been working on. For example:
class EmailValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
if value.present? && !/\A[^\p{Z}]+#[^\p{Z}]+\.[^\p{Z}]+\z/.match?(value)
record.errors.add(attribute, "must be an email")
end
end
end
This approach worked fine, but many of my custom validators were similarly checking for a regex match so I decided to create an abstract RegexValidator class:
class RegexValidator < ActiveModel::EachValidator
self.abstract_class = true
def regex
raise "Children of this class must implement the 'regex' method."
end
def message(record, attribute, value)
raise "Children of this class must implement the 'message(record, attribute, value)' method."
end
def validate_each(record, attribute, value)
if value.present? && !regex.match?(value)
record.errors.add(attribute, message(record, attribute, value))
end
end
end
So now EmailValidator is implemented like so:
class EmailValidator < RegexValidator
def regex
/\A[^\p{Z}]+#[^\p{Z}]+\.[^\p{Z}]+\z/
end
def message(record, attribute, value)
"must be an email"
end
end
However, since this change Rails 5 no longer autoloads my EmailValidator even though both RegexValidator and EmailValidator are placed in appropriately named files, regex_validator.rb and email_validator.rb, in the app/validators folder which was being autoloaded before (this makes this question different from a similar question). I suspect this is because EmailValidator no longer directly inherits from ActiveModel::EachValidator, but this should not matter.
For reference, the following error occurred when I tried to generate a migration file:
/var/lib/gems/2.5.0/gems/activemodel-5.2.2/lib/active_model/validations/validates.rb:121:in `rescue in block in validates': Unknown validator: 'EmailValidator' (ArgumentError)
from /var/lib/gems/2.5.0/gems/activemodel-5.2.2/lib/active_model/validations/validates.rb:118:in `block in validates'
from /var/lib/gems/2.5.0/gems/activemodel-5.2.2/lib/active_model/validations/validates.rb:114:in `each'
from /var/lib/gems/2.5.0/gems/activemodel-5.2.2/lib/active_model/validations/validates.rb:114:in `validates'
from /home/tomeraberbach/Desktop/msf/src/app/models/user.rb:7:in `<class:User>'
from /home/tomeraberbach/Desktop/msf/src/app/models/user.rb:4:in `<main>'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:476:in `block in load_file'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:661:in `new_constants_in'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:475:in `load_file'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:373:in `block in require_or_load'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:37:in `block in load_interlock'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:13:in `loading'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:37:in `load_interlock'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:356:in `require_or_load'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:46:in `block in require_or_load'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:45:in `require_or_load'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:510:in `load_missing_constant'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in `block in load_missing_constant'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:57:in `load_missing_constant'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:195:in `const_missing'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/inflector/methods.rb:283:in `const_get'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/inflector/methods.rb:283:in `block in constantize'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/inflector/methods.rb:281:in `each'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/inflector/methods.rb:281:in `inject'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/inflector/methods.rb:281:in `constantize'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:582:in `get'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:613:in `constantize'
from /var/lib/gems/2.5.0/gems/devise-4.5.0/lib/devise.rb:316:in `get'
from /var/lib/gems/2.5.0/gems/devise-4.5.0/lib/devise/mapping.rb:83:in `to'
from /var/lib/gems/2.5.0/gems/devise-4.5.0/lib/devise/mapping.rb:78:in `modules'
from /var/lib/gems/2.5.0/gems/devise-4.5.0/lib/devise/mapping.rb:95:in `routes'
from /var/lib/gems/2.5.0/gems/devise-4.5.0/lib/devise/mapping.rb:162:in `default_used_route'
from /var/lib/gems/2.5.0/gems/devise-4.5.0/lib/devise/mapping.rb:72:in `initialize'
from /var/lib/gems/2.5.0/gems/devise-4.5.0/lib/devise.rb:346:in `new'
from /var/lib/gems/2.5.0/gems/devise-4.5.0/lib/devise.rb:346:in `add_mapping'
from /var/lib/gems/2.5.0/gems/devise-4.5.0/lib/devise/rails/routes.rb:243:in `block in devise_for'
from /var/lib/gems/2.5.0/gems/devise-4.5.0/lib/devise/rails/routes.rb:242:in `each'
from /var/lib/gems/2.5.0/gems/devise-4.5.0/lib/devise/rails/routes.rb:242:in `devise_for'
from /home/tomeraberbach/Desktop/msf/src/config/routes.rb:3:in `block (2 levels) in <main>'
from /var/lib/gems/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/routing/mapper.rb:879:in `scope'
from /home/tomeraberbach/Desktop/msf/src/config/routes.rb:2:in `block in <main>'
from /var/lib/gems/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/routing/route_set.rb:432:in `instance_exec'
from /var/lib/gems/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/routing/route_set.rb:432:in `eval_block'
from /var/lib/gems/2.5.0/gems/actionpack-5.2.2/lib/action_dispatch/routing/route_set.rb:414:in `draw'
from /home/tomeraberbach/Desktop/msf/src/config/routes.rb:1:in `<main>'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `block in load'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `load'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/application/routes_reloader.rb:41:in `block in load_paths'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/application/routes_reloader.rb:41:in `each'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/application/routes_reloader.rb:41:in `load_paths'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/application/routes_reloader.rb:20:in `reload!'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/application/routes_reloader.rb:30:in `block in updater'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/file_update_checker.rb:83:in `execute'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/application/routes_reloader.rb:10:in `execute'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/application/finisher.rb:130:in `block in <module:Finisher>'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:32:in `instance_exec'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:32:in `run'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
from /usr/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
from /usr/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /usr/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /usr/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /usr/lib/ruby/2.5.0/tsort.rb:347:in `each'
from /usr/lib/ruby/2.5.0/tsort.rb:347:in `call'
from /usr/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
from /usr/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
from /usr/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:60:in `run_initializers'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/application.rb:361:in `initialize!'
from /home/tomeraberbach/Desktop/msf/src/config/environment.rb:5:in `<main>'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:102:in `preload'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from /usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from -e:1:in `<main>'
My User class:
##
# A class representing a user account for this web application
# Instances of this class represent rows in the +users+ table on the database.
class User < ApplicationRecord
# Validation
validates_presence_of :email, :encrypted_password
validates :email, email: true
# Associations
devise :database_authenticatable, :registerable, :recoverable,
:rememberable, :trackable, :validatable
has_and_belongs_to_many :roles
# Events
before_validation do
# Removes unnecessary whitespace
self.email = email.strip
end
end
Any ideas?
I figured out the problem. The self.abstract_class = true line in RegexValidator was silently raising an error because there is no self.abstract_class method in the class. I thought there was because I saw it in the ApplicationRecord class, but I now realize that this is defined in the ActiveRecord::Base class.
I determined this by adding require_relative "../validators/email_validator" to the top of the user.rb file. After doing that I was able to see the error which was silent before:
/home/tomeraberbach/Desktop/msf/src/app/validators/regex_validator.rb:4:in `<class:RegexValidator>': undefined method `abstract_class=' for RegexValidator:Class (NoMethodError)
After removing the self.abstract_class = true line and the require_relative "../validators/email_validator" line, the problem was resolved.

How can I debug a gem in Rails?

I'm attempting to start my rails server, but I'm getting the error trace below.
I've commented out the line mentioned here:
4.2.0/lib/audited/auditor.rb:48:in `audited'
from /home/david-vm/Documents/rails_projects/bane/app/models/user.rb:9:in `<class:User>'
, and I can get it to run, but I'm not sure why that is breaking it. So I was thinking of maybe using byebug to trace down the issue, but can't seem to figure out how I would go about that. Or is there another way I can troubleshoot this issue? Thanks!
Error
/home/david-vm/.rvm/gems/ruby-2.3.0/gems/tiny_tds-0.7.0/lib/tiny_tds/client.rb:74:in `connect': Server name not found in configuration files (TinyTds::Error)
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/tiny_tds-0.7.0/lib/tiny_tds/client.rb:74:in `initialize'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-sqlserver-adapter-4.2.3/lib/active_record/connection_adapters/sqlserver_adapter.rb:280:in `new'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-sqlserver-adapter-4.2.3/lib/active_record/connection_adapters/sqlserver_adapter.rb:280:in `dblib_connect'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-sqlserver-adapter-4.2.3/lib/active_record/connection_adapters/sqlserver_adapter.rb:271:in `connect'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-sqlserver-adapter-4.2.3/lib/active_record/connection_adapters/sqlserver_adapter.rb:59:in `initialize'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-sqlserver-adapter-4.2.3/lib/active_record/sqlserver_base.rb:18:in `new'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-sqlserver-adapter-4.2.3/lib/active_record/sqlserver_base.rb:18:in `sqlserver_connection'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:436:in `new_connection'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:446:in `checkout_new_connection'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:565:in `retrieve_connection'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_handling.rb:87:in `connection'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/model_schema.rb:230:in `table_exists?'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/attribute_methods/primary_key.rb:97:in `get_primary_key'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/attribute_methods/primary_key.rb:85:in `reset_primary_key'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.0/lib/active_record/attribute_methods/primary_key.rb:73:in `primary_key'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/audited-activerecord-4.2.0/lib/audited/adapters/active_record.rb:7:in `default_ignored_attributes'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/audited-4.2.0/lib/audited/auditor.rb:48:in `audited'
from /home/david-vm/Documents/rails_projects/bane/app/models/user.rb:9:in `<class:User>'
from /home/david-vm/Documents/rails_projects/bane/app/models/user.rb:1:in `<top (required)>'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:457:in `load'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:457:in `block in load_file'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:647:in `new_constants_in'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:456:in `load_file'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:354:in `require_or_load'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:494:in `load_missing_constant'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:184:in `const_missing'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:261:in `const_get'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:261:in `block in constantize'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:259:in `each'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:259:in `inject'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/inflector/methods.rb:259:in `constantize'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:566:in `get'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:597:in `constantize'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise.rb:377:in `get'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/mapping.rb:81:in `to'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/mapping.rb:76:in `modules'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/mapping.rb:93:in `routes'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/mapping.rb:160:in `default_used_route'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/mapping.rb:70:in `initialize'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise.rb:411:in `new'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise.rb:411:in `add_mapping'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/rails/routes.rb:241:in `block in devise_for'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/rails/routes.rb:240:in `each'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/devise-4.0.1/lib/devise/rails/routes.rb:240:in `devise_for'
from /home/david-vm/Documents/rails_projects/bane/config/routes.rb:11:in `block in <top (required)>'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:423:in `instance_exec'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:423:in `eval_block'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb:401:in `draw'
from /home/david-vm/Documents/rails_projects/bane/config/routes.rb:1:in `<top (required)>'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:40:in `each'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/file_update_checker.rb:75:in `execute'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:27:in `updater'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each'
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `call'
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
from /home/david-vm/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!'
from /home/david-vm/Documents/rails_projects/bane/config/environment.rb:5:in `<top (required)>'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/application.rb:328:in `require_environment!'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:142:in `require_application_and_environment!'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:67:in `console'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/david-vm/.rvm/gems/ruby-2.3.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
User.rb
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :ldap_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
after_destroy :ensure_an_admin_remains
before_create { generate_token(:auth_token) }
# Audit changes made except for the columns as specified below
audited except: [:last_seen_at, :sign_in_count, :last_sign_in_at, :last_sign_in_ip, :password_digest]
has_associated_audits
acts_as_tagger
acts_as_taggable_on :roles
# associations, methods, etc...
end
Update
Turns out it was a DNS issue, so even though my database.yml hadn't changed- the server name was no longer working. Just added the update in case anyone is having this similar issue, might be worth checking this out.
The answer is IN the stack trace. It's telling you exactly what file ON your system is having the error. The fact that that file came from a gem, or lives in a different part of your computer, is irrelevant.
/home/david-vm/.rvm/gems/ruby-2.3.0/gems/tiny_tds-0.7.0/lib/tiny_tds/client.rb:74:in `connect': Server name not found in configuration files (TinyTds::Error)
Open that file (or whatever file in the backtrace seems most appropriate) with your editor, stick a binding.pry (or byebug, or debugger, whatever you're using) in there before the line it's blowing up on (74). Then restart your app and debug as if it was a file in your app.

Devise generate view

I am following this tutorial:
http://www.rubyonrailstree.blogspot.com/2014/02/ruby-on-rails-device-gem-install-step.html
and I am having trouble with:
rails g devise:views
&
rake db:migrate
both comming up with a simmilar error of:
/home/zach/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.4/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `attr_accessible' for User (call 'User.connection' to establish a connection):Class (NoMethodError)
from /home/zach/HandCoOp/project/HandCo-op/app/models/user.rb:8:in `<class:User>'
from /home/zach/HandCoOp/project/HandCo-op/app/models/user.rb:1:in `<top (required)>'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:443:in `load'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:443:in `block in load_file'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:633:in `new_constants_in'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:442:in `load_file'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:342:in `require_or_load'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:480:in `load_missing_constant'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:180:in `const_missing'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:238:in `const_get'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:238:in `block in constantize'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:236:in `each'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:236:in `inject'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/inflector/methods.rb:236:in `constantize'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:552:in `get'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:583:in `constantize'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/devise-1.4.7/lib/devise.rb:259:in `get'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/devise-1.4.7/lib/devise/mapping.rb:103:in `to'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/devise-1.4.7/lib/devise/mapping.rb:98:in `modules'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/devise-1.4.7/lib/devise/mapping.rb:115:in `routes'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/devise-1.4.7/lib/devise/mapping.rb:84:in `initialize'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/devise-1.4.7/lib/devise.rb:289:in `new'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/devise-1.4.7/lib/devise.rb:289:in `add_mapping'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/devise-1.4.7/lib/devise/rails/routes.rb:190:in `block in devise_for'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/devise-1.4.7/lib/devise/rails/routes.rb:189:in `each'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/devise-1.4.7/lib/devise/rails/routes.rb:189:in `devise_for'
from /home/zach/HandCoOp/project/HandCo-op/config/routes.rb:2:in `block in <top (required)>'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:337:in `instance_exec'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:337:in `eval_block'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.4/lib/action_dispatch/routing/route_set.rb:315:in `draw'
from /home/zach/HandCoOp/project/HandCo-op/config/routes.rb:1:in `<top (required)>'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `block in load'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `each'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/file_update_checker.rb:75:in `call'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/file_update_checker.rb:75:in `execute'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:27:in `updater'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application/finisher.rb:71:in `block in <module:Finisher>'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `instance_exec'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `run'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/zach/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /home/zach/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/zach/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /home/zach/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/zach/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /home/zach/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /home/zach/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/zach/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /home/zach/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:54:in `run_initializers'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application.rb:300:in `initialize!'
from /home/zach/HandCoOp/project/HandCo-op/config/environment.rb:5:in `<top (required)>'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `block in require'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application.rb:276:in `require_environment!'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:147:in `require_application_and_environment!'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:133:in `generate_or_destroy'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:51:in `generate'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /home/zach/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Am I using version of ruby that does not support this yet? I will keep looking into this error and I thank anyone who has information about this issue.
routes.rb:
Rails.application.routes.draw do
devise_for :users
root 'home#index'
user.rb model:
class User < ActiveRecord::Base
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
:email
:password
:password_confirmation
:remember_me
end
thanks, hope this helps!
root 'home#index' should be changed root to: "home#index".
Starting from Rails 4 you do not use attr_accessible. You will have to remove the line.
when using a gem the better solution is to appeal to its docs. So in your case the command to generate views (after you added gem 'devise' to Gemfile and run bundle) should be
a) rails generate devise:install,
b) rails generate devise:views

Error Adding a Migration: `default_controller_and_action': missing :action (ArgumentError)

I'm trying add the following migration:
rails g migration AddConfirmableToUsers confirmation_token:string confirmed_at:datetime confirmation_sent_at:datetime unconfirmed_email:string
However, it raised the following error I'm unable to troubleshoot:
/Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:179:in `default_controller_and_action': missing :action (ArgumentError)
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:72:in `normalize_options!'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:60:in `initialize'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:1308:in `new'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:1308:in `add_route'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:1287:in `decomposed_match'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:1269:in `block in match'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:1269:in `each'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:1269:in `match'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:254:in `root'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:1321:in `root'
from /Users/tn/rails_projects/rails-prelaunch-signup/config/routes.rb:5:in `block in <top (required)>'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:289:in `instance_exec'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:289:in `eval_block'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:267:in `draw'
from /Users/tn/rails_projects/rails-prelaunch-signup/config/routes.rb:1:in `<top (required)>'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in `each'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/activesupport-3.2.13/lib/active_support/file_update_checker.rb:78:in `call'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/activesupport-3.2.13/lib/active_support/file_update_checker.rb:78:in `execute'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:27:in `updater'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/tn/rails_projects/rails-prelaunch-signup/config/environment.rb:5:in `<top (required)>'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
from /Users/tn/.rvm/gems/ruby-2.0.0-rc1#global/gems/railties-3.2.13/lib/rails/commands.rb:25:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I thought it might be an issue with my routes.rb file but couldn't find an issue with it.
RailsPrelaunchSignup::Application.routes.draw do
root to: "root_path"
end
User.rb
class User < ActiveRecord::Base
rolify
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :name, :email, :password, :password_confirmation, :remember_me
end
Any help would be much appreciated!
It is indeed your routes file:
root to: "root_path"
This should be something like:
root to: "controller#action"
root_path is the helper name that is automatically generated by Rails when you have a root definition in your routes file.

Rails server suddenly went down

I am working on an app and the rails servr was working fine, but suddenly it has stopped. I tried rebooting my system (iOS) and starting the server again and again and I get this error -
/Users/alokdas/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:197: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
/Users/alokdas/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:197: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
=> Booting WEBrick
=> Rails 3.2.11 application starting in development on htt.://0.0.0.3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations/length.rb:14:in `initialize': :in and :within must be a Range (ArgumentError)
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations/with.rb:82:in `new'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations/with.rb:82:in `block in validates_with'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations/with.rb:81:in `each'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations/with.rb:81:in `validates_with'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations/length.rb:121:in `validates_length_of'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models/validatable.rb:35:in `block in included'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models/validatable.rb:28:in `class_eval'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models/validatable.rb:28:in `included'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models.rb:112:in `include'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models.rb:112:in `block (2 levels) in devise'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models.rb:92:in `each'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models.rb:92:in `block in devise'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models.rb:123:in `devise_modules_hook!'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models.rb:90:in `devise'
from /users/alokdas/code/omrails/app/models/view.rb:5:in `<class:View>'
from /users/alokdas/code/omrails/app/models/view.rb:1:in `<top (required)>'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:469:in `load'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:469:in `block in load_file'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:639:in `new_constants_in'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:468:in `load_file'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:353:in `require_or_load'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:502:in `load_missing_constant'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:192:in `block in const_missing'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:190:in `each'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:190:in `const_missing'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb:230:in `block in constantize'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb:229:in `each'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb:229:in `constantize'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:554:in `get'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:588:in `constantize'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise.rb:267:in `get'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/mapping.rb:77:in `to'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/mapping.rb:72:in `modules'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/mapping.rb:89:in `routes'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/mapping.rb:156:in `default_used_route'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/mapping.rb:66:in `initialize'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise.rb:301:in `new'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise.rb:301:in `add_mapping'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/rails/routes.rb:208:in `block in devise_for'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/rails/routes.rb:207:in `each'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/rails/routes.rb:207:in `devise_for'
from /users/alokdas/code/omrails/config/routes.rb:2:in `block in <top (required)>'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:282:in `eval_block'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:260:in `draw'
from /users/alokdas/code/omrails/config/routes.rb:1:in `<top (required)>'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `block in load'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:40:in `each'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/file_update_checker.rb:78:in `call'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/file_update_checker.rb:78:in `execute'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:27:in `updater'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /users/alokdas/code/omrails/config/environment.rb:5:in `<top (required)>'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /users/alokdas/code/omrails/config.ru:3:in `block in <main>'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.4.4/lib/rack/builder.rb:51:in `instance_eval'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.4.4/lib/rack/builder.rb:51:in `initialize'
from /users/alokdas/code/omrails/config.ru:in `new'
from /users/alokdas/code/omrails/config.ru:in `<main>'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.4.4/lib/rack/builder.rb:40:in `eval'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.4.4/lib/rack/builder.rb:40:in `parse_file'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.4.4/lib/rack/server.rb:200:in `app'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands/server.rb:46:in `app'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.4.4/lib/rack/server.rb:304:in `wrapped_app'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.4.4/lib/rack/server.rb:254:in `start'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands/server.rb:70:in `start'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands.rb:55:in `block in <top (required)>'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands.rb:50:in `tap'
from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Just before this I had run - rails generate devise:views
Thanks for your help
More Info -
I had used - rails generate devise:install - before and it had created a Sign-up page.
Now I remember that I had used the command 'rails generate devise views' (without the colon in-between) and it had created some files, but not sure where. Could that have created some conflicts?
Here is my view.rb file from Model
class View < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
# attr_accessible :title, :body
end
Looks like you did not run rails g devise:install, and i think that if you run and rails g command it will also fail. best option, try installing devise again and if it fails, manually delete all devise related files and try again.

Resources