I've recently upgraded my rails 3.2 project to 4.0. I've been successful in upgrading my app for the most part by following the guides. I have a few issues that I'm not sure what direction I should go and I'm looking for some help.
I was using quite a few attr_accessible on my models that I've now removed based in the advice in the guides. The guides say :
Rails 4.0 has removed attr_accessible and attr_protected feature in
favor of Strong Parameters. You can use the Protected Attributes gem
for a smooth upgrade path.
This gem got my application running but anytime I try to create a new object such as a user, message, etc. I get an error. From some research this seems common when using the new gem. It was suggested to remove the gem which would solve the new object issues. I did that but now I'm getting multiple errors from some of the other gems in my applications (And yes I've upgraded all gems to the most recent versions). Here is the error I'm getting:
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activemodel-4.0.0/lib/active_model/deprecated_mass_assignment_security.rb:14:in `attr_accessible': `attr_accessible` is extracted out of Rails into a gem. Please use new recommended protection model for params(strong_parameters) or add `protected_attributes` to your Gemfile to use old one. (RuntimeError)
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/acts-as-messageable-0.4.8/lib/acts-as-messageable/message.rb:8:in `<class:Message>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/acts-as-messageable-0.4.8/lib/acts-as-messageable/message.rb:4:in `<module:ActsAsMessageable>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/acts-as-messageable-0.4.8/lib/acts-as-messageable/message.rb:3:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:228:in `const_get'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:228:in `block in constantize'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:in `each'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:in `inject'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:in `constantize'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/core_ext/string/inflections.rb:66:in `constantize'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/acts-as-messageable-0.4.8/lib/acts-as-messageable/model.rb:34:in `acts_as_messageable'
from /Users/dave/rails_projects/EquiptMe/app/models/user.rb:14:in `<class:User>'
from /Users/dave/rails_projects/EquiptMe/app/models/user.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:423:in `load'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:423:in `block in load_file'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:615:in `new_constants_in'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:422:in `load_file'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:323:in `require_or_load'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:462:in `load_missing_constant'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:183:in `const_missing'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:226:in `const_get'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:226:in `block in constantize'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:in `each'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:in `inject'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:in `constantize'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:534:in `get'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:565:in `constantize'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.1/lib/devise.rb:278:in `get'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.1/lib/devise/mapping.rb:77:in `to'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.1/lib/devise/mapping.rb:72:in `modules'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.1/lib/devise/mapping.rb:89:in `routes'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.1/lib/devise/mapping.rb:156:in `default_used_route'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.1/lib/devise/mapping.rb:66:in `initialize'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.1/lib/devise.rb:312:in `new'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.1/lib/devise.rb:312:in `add_mapping'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.1/lib/devise/rails/routes.rb:208:in `block in devise_for'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.1/lib/devise/rails/routes.rb:207:in `each'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/devise-3.0.1/lib/devise/rails/routes.rb:207:in `devise_for'
from /Users/dave/rails_projects/EquiptMe/config/routes.rb:7:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `eval_block'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:294:in `draw'
from /Users/dave/rails_projects/EquiptMe/config/routes.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `each'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `call'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `execute'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:27:in `updater'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/dave/rails_projects/EquiptMe/config/environment.rb:5:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /Users/dave/rails_projects/EquiptMe/config.ru:3:in `block in <main>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /Users/dave/rails_projects/EquiptMe/config.ru:in `new'
from /Users/dave/rails_projects/EquiptMe/config.ru:in `<main>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands/server.rb:48:in `app'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands/server.rb:75:in `start'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /usr/local/rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Could someone point me in the right direction?
Thanks
I would try using the master branch of the "acts-as-messageable" gem in your Gemfile. It looks like there have been some updates related to Rails 4 since it was last released. If that fixes it, I'd ping the author to see if they'd release a new version.
There is a new gem created recently to help with upgrading from Rails 3 to Rails 4. I've used it recently and it made the upgrading process so much easier.
The gem is called wize_upgrader.
One thing that this gem does with attr_accessible in rails 3 models is that is converts it into strong params for you in your controller.
i.e: (in posts_controller)
def post_params
params.require(:post).permit(:title, :content, :tag)
end
Related
When I try to perform "rails generate devise:install" I get this error message:
I've tried re-installing the devise gem multiple times. This error also comes up when I try to start up my server. I'm wondering if the cause of this is from initially trying to install the devise gem with "rails generate devise install" instead of putting a colon between devise and install.
Maxs-MacBook-Air:pinteresting allecat941$ rails generate devise:install
/Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activerecord-4.1.1/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `devise' for Install (call 'Install.connection' to establish a connection):Class (NoMethodError)
from /Users/allecat941/pinteresting/app/models/install.rb:4:in `<class:Install>'
from /Users/allecat941/pinteresting/app/models/install.rb:1:in `<top (required)>'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:443:in `load'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:443:in `block in load_file'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:633:in `new_constants_in'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:442:in `load_file'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:342:in `require_or_load'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:480:in `load_missing_constant'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:180:in `const_missing'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:238:in `const_get'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:238:in `block in constantize'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:236:in `each'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:236:in `inject'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:236:in `constantize'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:552:in `get'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:583:in `constantize'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/devise-3.2.4/lib/devise.rb:297:in `get'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/devise-3.2.4/lib/devise/mapping.rb:77:in `to'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/devise-3.2.4/lib/devise/mapping.rb:72:in `modules'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/devise-3.2.4/lib/devise/mapping.rb:89:in `routes'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/devise-3.2.4/lib/devise/mapping.rb:156:in `default_used_route'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/devise-3.2.4/lib/devise/mapping.rb:66:in `initialize'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/devise-3.2.4/lib/devise.rb:331:in `new'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/devise-3.2.4/lib/devise.rb:331:in `add_mapping'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/devise-3.2.4/lib/devise/rails/routes.rb:221:in `block in devise_for'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/devise-3.2.4/lib/devise/rails/routes.rb:220:in `each'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/devise-3.2.4/lib/devise/rails/routes.rb:220:in `devise_for'
from /Users/allecat941/pinteresting/config/routes.rb:2:in `block in <top (required)>'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:335:in `instance_exec'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:335:in `eval_block'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:313:in `draw'
from /Users/allecat941/pinteresting/config/routes.rb:1:in `<top (required)>'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `block in load'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:in `each'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/file_update_checker.rb:75:in `call'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/file_update_checker.rb:75:in `execute'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:27:in `updater'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application/finisher.rb:71:in `block in <module:Finisher>'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `run'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/allecat941/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /Users/allecat941/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /Users/allecat941/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /Users/allecat941/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /Users/allecat941/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /Users/allecat941/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /Users/allecat941/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/railties-4.1.1/lib/rails/application.rb:288:in `initialize!'
from /Users/allecat941/pinteresting/config/environment.rb:5:in `<top (required)>'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/application.rb:92:in `preload'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/application.rb:140:in `serve'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/application.rb:122:in `run'
from /Users/allecat941/.rvm/gems/ruby-2.1.1/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/allecat941/.rbenv/versions/2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/allecat941/.rbenv/versions/2.0.0-p451/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
It looks like your accidental install created Install model and other files. Delete those, perhaps?
I am using the device gem and without devise install . Then use, the cmd rails g device auth in this case rails throw the error than using this method my problem is solved
extend Devise::Models
in my auth.rb files
class Auth < ApplicationRecord
extend Devise::Models
end
just started learning Ruby on Rails, I'm trying to install the devise gem for creating a login/signin lesson, but I keep getting the following messages..
Could anyone help please? and feel free to correct me on how i'm asking the questions. New to this community and would love to be involved.
alexs-air:pinteresting alexkwon$ rails generate devise:install
/Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.1/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `devise' for Install (call 'Install.connection' to establish a connection):Class (NoMethodError)
from /Users/alexkwon/Desktop/pinteresting/app/models/install.rb:4:in `<class:Install>'
from /Users/alexkwon/Desktop/pinteresting/app/models/install.rb:1:in `<top (required)>'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:443:in `load'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:443:in `block in load_file'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:633:in `new_constants_in'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:442:in `load_file'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:342:in `require_or_load'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:480:in `load_missing_constant'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:180:in `const_missing'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:238:in `const_get'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:238:in `block in constantize'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:236:in `each'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:236:in `inject'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:236:in `constantize'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:552:in `get'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:583:in `constantize'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise.rb:297:in `get'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/mapping.rb:77:in `to'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/mapping.rb:72:in `modules'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/mapping.rb:89:in `routes'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/mapping.rb:156:in `default_used_route'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/mapping.rb:66:in `initialize'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise.rb:331:in `new'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise.rb:331:in `add_mapping'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/rails/routes.rb:221:in `block in devise_for'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/rails/routes.rb:220:in `each'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/devise-3.2.4/lib/devise/rails/routes.rb:220:in `devise_for'
from /Users/alexkwon/Desktop/pinteresting/config/routes.rb:2:in `block in <top (required)>'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:335:in `instance_exec'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:335:in `eval_block'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:313:in `draw'
from /Users/alexkwon/Desktop/pinteresting/config/routes.rb:1:in `<top (required)>'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `block in load'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:in `each'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/file_update_checker.rb:75:in `call'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/file_update_checker.rb:75:in `execute'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:27:in `updater'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/finisher.rb:71:in `block in <module:Finisher>'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `run'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/alexkwon/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /Users/alexkwon/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /Users/alexkwon/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /Users/alexkwon/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /Users/alexkwon/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /Users/alexkwon/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /Users/alexkwon/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /Users/alexkwon/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /Users/alexkwon/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application.rb:288:in `initialize!'
from /Users/alexkwon/Desktop/pinteresting/config/environment.rb:5:in `<top (required)>'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application.rb:264:in `require_environment!'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:147:in `require_application_and_environment!'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:133:in `generate_or_destroy'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:51:in `generate'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/alexkwon/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:8:in `require'
from bin/rails:8:in `<main>'
Welcome to Rails man.
I know the community is all up on the devise gem. The reality is that Devise is an advanced authentication app that's a gem.
If you're learning, and you need authentication, some super geek named Ryan Bates hooked you up with a tutorial and screencast on basic authentication that will work exactly how you need it, and you will understand what's going on:
http://railscasts.com/episodes/250-authentication-from-scratch
WHABAM!
Be mindful that is based on rails 3. Check the differences between rails, and ruby versions if you encounter problems while following directions. If you do get errors, still, this path will get your further to deploying that app of yours.
Come back to Devise when you need the features it provides, Rails, and confident you can implement ideas found in the book 'Crafting Rails Application' by José Valim. He's one of the main contributors of Devise, so you'll get insight on his thought process.
I was following the instructions at http://www.activeadmin.info/docs/0-installation.html#gemfile under the heading Register your models with Active Admin. Before adding the resource of Post I was able to start my server just fine. Once I added the resource of Post, it would no longer start. It was giving me an error about the I18n.config.enforce_available_locales needing to be set to false to prevent the error message. I found another Stack Overflow post which said to set this to false in the application.rb file. After doing this the message no longer shows in my Terminal interface, but the servers don't start.
Now I am getting the following output in Terminal when I run $ rails server
/Applications/MAMP/htdocs/ruby-review/app/admin/post.rb:1:in `<top (required)>': uninitialized constant Post (NameError)
from /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/application.rb:179:in `load'
from /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/application.rb:171:in `block in load!'
from /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/application.rb:171:in `each'
from /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/application.rb:171:in `load!'
from /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/application.rb:195:in `routes'
from /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin.rb:80:in `routes'
from /Applications/MAMP/htdocs/ruby-review/config/routes.rb:3:in `block in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:341:in `instance_exec'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:341:in `eval_block'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:319:in `draw'
from /Applications/MAMP/htdocs/ruby-review/config/routes.rb:1:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:in `each'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.3/lib/active_support/file_update_checker.rb:75:in `call'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.3/lib/active_support/file_update_checker.rb:75:in `execute'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:27:in `updater'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:30:in `instance_exec'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:30:in `run'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:54:in `run_initializers'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application.rb:215:in `initialize!'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Applications/MAMP/htdocs/ruby-review/config/environment.rb:5:in `<top (required)>'
from /Applications/MAMP/htdocs/ruby-review/config.ru:3:in `block in <main>'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /Applications/MAMP/htdocs/ruby-review/config.ru:in `new'
from /Applications/MAMP/htdocs/ruby-review/config.ru:in `<main>'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/commands/server.rb:48:in `app'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/commands/server.rb:75:in `start'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:76:in `block in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `tap'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
How to I initialize the Constant of Post?
My apologies if these errors seem obvious to some. I am still new to rails.
You have to have a Post model. Do this:
$ rails g model Post
$ rake db:migrate
After installing devise with devise_install successfully, when restarting the server, I am getting the following error. Please help me. I have gone through number of questions and I am not getting correct response .
Error :
bfmt048#bfmt048-System-Product-Name:~/demo$ rails s
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on zero.zero.zero.zero:threethousand
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activemodel-4.0.0/lib/active_model/validations/format.rb:46:in `check_options_validity': The provided regular expression is using multiline anchors (^ or $), which may present a security risk. Did you mean to use \A and \z, or forgot to add the :multiline => true option? (ArgumentError)
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activemodel-4.0.0/lib/active_model/validations/format.rb:20:in `check_validity!'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activemodel-4.0.0/lib/active_model/validator.rb:143:in `initialize'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activemodel-4.0.0/lib/active_model/validations/with.rb:87:in `new'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activemodel-4.0.0/lib/active_model/validations/with.rb:87:in `block in validates_with'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activemodel-4.0.0/lib/active_model/validations/with.rb:86:in `each'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activemodel-4.0.0/lib/active_model/validations/with.rb:86:in `validates_with'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activemodel-4.0.0/lib/active_model/validations/format.rb:111:in `validates_format_of'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/models/validatable.rb:20:in `block in included'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/models/validatable.rb:17:in `class_eval'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/models/validatable.rb:17:in `included'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/models.rb:63:in `include'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/models.rb:63:in `block (2 levels) in devise'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/models.rb:63:in `each'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/models.rb:63:in `block in devise'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/models.rb:77:in `devise_modules_hook!'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/models.rb:62:in `devise'
from /home/bfmt048/demo/app/models/user.rb:4:in `<class:User>'
from /home/bfmt048/demo/app/models/user.rb:1:in `<top (required)>'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:423:in `load'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:423:in `block in load_file'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:615:in `new_constants_in'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:422:in `load_file'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:323:in `require_or_load'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:462:in `load_missing_constant'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:183:in `const_missing'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:226:in `const_get'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:226:in `block in constantize'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:in `each'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:in `inject'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/inflector/methods.rb:224:in `constantize'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/core_ext/string/inflections.rb:66:in `constantize'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/mapping.rb:75:in `to'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/mapping.rb:68:in `modules'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/mapping.rb:81:in `strategies'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise.rb:166:in `register'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/rails/routes.rb:93:in `block in devise_for'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/rails/routes.rb:92:in `each'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/devise-1.1.rc0/lib/devise/rails/routes.rb:92:in `devise_for'
from /home/bfmt048/demo/config/routes.rb:3:in `block in <top (required)>'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `instance_exec'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `eval_block'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:294:in `draw'
from /home/bfmt048/demo/config/routes.rb:1:in `<top (required)>'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `each'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `call'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `execute'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:27:in `updater'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/bfmt048/demo/config/environment.rb:5:in `<top (required)>'
from /home/bfmt048/demo/config.ru:3:in `require'
from /home/bfmt048/demo/config.ru:3:in `block in <main>'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /home/bfmt048/demo/config.ru:in `new'
from /home/bfmt048/demo/config.ru:in `<main>'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/server.rb:48:in `app'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/server.rb:75:in `start'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /home/bfmt048/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
ArgumentError: The provided regular expression is using multiline anchors (^ or $),
which may present a security risk. Did you mean to use \A and \z,
or forgot to add the :multiline => true option?
This error occurs when trying to upgrade from previous version of rails to rails 4.0.0.
Regexp validation for validates_format_of.
If you don’t expect multiline incoming data, you need to replace all the “^” with “\A” and all the “$” with “\z”. If you expect multiline strings, just specify the multiline: true option.
Source: http://dev.mensfeld.pl/2013/07/upgrading-to-rails-4-0-from-rails-3-2-test-case-part-ii-assets-models/
Not sure of the specific reason for your error, but I would try updating devise to latest version which supports rails 4.0.0.
this is a new check in rails 4. why are you using such an old devise version (and why an rc?). just use the most recent release by putting
gem "devise", "~> 3.0.3"
in your Gemfile
It's not safe to use ^ and $ since $ matches \n (new-line characted) which has the possibility to enter an email like "test123#example.com\n< script>/* ... */< /script >"
http://edgeguides.rubyonrails.org/active_record_validations.html#format
So if we use ^ and $ to match the end or beginning of an expression then the above is likely to pass the filter and any malicious code can be passed in with the email entered.
We can either use the /A, /Z option to specfy the beginning and end of a line, instead of ^ and $, or else we can set the :multiline option to true
eg: validates :content, format: { with: /^Meanwhile$/, multiline: true }
http://edgeguides.rubyonrails.org/security.html#regular-expressions
I just now my rails app to rails 4 from rails 3. I am not able to get it to work. I have done all the necessary configuration removal and addition whereever necessary. But now I am facing this. IS the question too blunt? IF so comment on what information is needed to make it more understandable. I am a totally new to rails, please help.
/home/aravind/Documents/dev/ptl/config/initializers/simple_form.rb:8:in `block in <top (required)>': undefined method `wrappers' for SimpleForm:Module (NoMethodError)
from /usr/local/lib/ruby/gems/2.0.0/gems/simple_form-1.4.1/lib/simple_form.rb:143:in `setup'
from /home/aravind/Documents/dev/ptl/config/initializers/simple_form.rb:2:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
from /usr/local/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
from /usr/local/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /usr/local/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:609:in `block (2 levels) in <class:Engine>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:608:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:608:in `block in <class:Engine>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /usr/local/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /usr/local/lib/ruby/2.0.0/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from'
from /usr/local/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /usr/local/lib/ruby/2.0.0/tsort.rb:209:in `block in each_strongly_connected_component_from'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:44:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:44:in `tsort_each_child'
from /usr/local/lib/ruby/2.0.0/tsort.rb:203:in `each_strongly_connected_component_from'
from /usr/local/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /usr/local/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /usr/local/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /usr/local/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/aravind/Documents/dev/ptl/config/environment.rb:5:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
from /usr/local/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /usr/local/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /home/aravind/Documents/dev/ptl/config.ru:3:in `block in <main>'
from /usr/local/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /usr/local/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /home/aravind/Documents/dev/ptl/config.ru:in `new'
from /home/aravind/Documents/dev/ptl/config.ru:in `<main>'
from /usr/local/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /usr/local/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /usr/local/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /usr/local/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/server.rb:48:in `app'
from /usr/local/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/server.rb:75:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
it looks like you are running simple_form 1.4.1 try upgrading it to the latest version. which should work with rails 4. if you are specifying a version in your Gemfile remove the version tag, and run bundle update
Give this a go gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git'. I think you need a more recent version of simple_form.