Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails server argument error

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>'
like image 495
siddhu Avatar asked Sep 04 '13 11:09

siddhu


2 Answers

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

like image 43
Marian Theisen Avatar answered Sep 28 '22 05:09

Marian Theisen


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.

like image 106
xvidun Avatar answered Sep 28 '22 05:09

xvidun