{"id":612,"date":"2022-08-30T15:04:15","date_gmt":"2022-08-30T15:04:15","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/undefined-method-downcase-for-0fixnum-in-devise-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:04:15","modified_gmt":"2022-08-30T15:04:15","slug":"undefined-method-downcase-for-0fixnum-in-devise-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/undefined-method-downcase-for-0fixnum-in-devise-collection-of-common-programming-errors\/","title":{"rendered":"undefined method `downcase!&#39; for 0:Fixnum in Devise-Collection of common programming errors"},"content":{"rendered":"<p>I have the following error when submitting my registration information:<\/p>\n<pre><code>   NoMethodError in Devise::RegistrationsController#create\n\nundefined method `downcase!' for 0:Fixnum\n<\/code><\/pre>\n<p>\\livu_pamatskola\\app\\views\\devise\\registrations\\new.html.erb:<\/p>\n<h1><code>Re\u0123istr\u0101cija<\/code><\/h1>\n<pre>\n\n resource_name, :url =&gt; registration_path(resource_name)) do |f| %&gt;\n  \n\n\n    \n    \n    \n    \n    \n    \n    \n     true %&gt;\n    \n    \n    \n    \n    \n    \n\n     \"button-link\" %&gt;\n\n<\/pre>\n<p><code>I understand that the problem is in Registrations Controller, as I think, but I don't have a such controller. I have searched all over the internet for solutions, but I haven't find anything, just spent a lot of time, so I need your help.<\/code><\/p>\n<p><code>Trace:<\/code><\/p>\n<pre><code><code>activesupport (3.2.8) lib\/active_support\/core_ext\/object\/try.rb:36:in `try'\ndevise (2.2.1) lib\/devise\/models\/authenticatable.rb:172:in `apply_to_attribute_or_variable'\ndevise (2.2.1) lib\/devise\/models\/authenticatable.rb:163:in `block in downcase_keys'\ndevise (2.2.1) lib\/devise\/models\/authenticatable.rb:163:in `each'\ndevise (2.2.1) lib\/devise\/models\/authenticatable.rb:163:in `downcase_keys'\nactivesupport (3.2.8) lib\/active_support\/callbacks.rb:407:in `_run__271922054__validation__371060191__callbacks'\nactivesupport (3.2.8) lib\/active_support\/callbacks.rb:405:in `__run_callback'\nactivesupport (3.2.8) lib\/active_support\/callbacks.rb:385:in `_run_validation_callbacks'\nactivesupport (3.2.8) lib\/active_support\/callbacks.rb:81:in `run_callbacks'\nactivemodel (3.2.8) lib\/active_model\/validations\/callbacks.rb:53:in `run_validations!'\nactivemodel (3.2.8) lib\/active_model\/validations.rb:194:in `valid?'\nactiverecord (3.2.8) lib\/active_record\/validations.rb:69:in `valid?'\nactiverecord (3.2.8) lib\/active_record\/validations.rb:77:in `perform_validations'\nactiverecord (3.2.8) lib\/active_record\/validations.rb:50:in `save'\nactiverecord (3.2.8) lib\/active_record\/attribute_methods\/dirty.rb:22:in `save'\nactiverecord (3.2.8) lib\/active_record\/transactions.rb:241:in `block (2 levels) in save'\nactiverecord (3.2.8) lib\/active_record\/transactions.rb:295:in `block in with_transaction_returning_status'\nactiverecord (3.2.8) lib\/active_record\/connection_adapters\/abstract\/database_statements.rb:192:in `transaction'\nactiverecord (3.2.8) lib\/active_record\/transactions.rb:208:in `transaction'\nactiverecord (3.2.8) lib\/active_record\/transactions.rb:293:in `with_transaction_returning_status'\nactiverecord (3.2.8) lib\/active_record\/transactions.rb:241:in `block in save'\nactiverecord (3.2.8) lib\/active_record\/transactions.rb:252:in `rollback_active_record_state!'\nactiverecord (3.2.8) lib\/active_record\/transactions.rb:240:in `save'\ndevise (2.2.1) app\/controllers\/devise\/registrations_controller.rb:15:in `create'\nactionpack (3.2.8) lib\/action_controller\/metal\/implicit_render.rb:4:in `send_action'\nactionpack (3.2.8) lib\/abstract_controller\/base.rb:167:in `process_action'\nactionpack (3.2.8) lib\/action_controller\/metal\/rendering.rb:10:in `process_action'\nactionpack (3.2.8) lib\/abstract_controller\/callbacks.rb:18:in `block in process_action'\nactivesupport (3.2.8) lib\/active_support\/callbacks.rb:436:in `_run__1051681660__process_action__714589613__callbacks'\nactivesupport (3.2.8) lib\/active_support\/callbacks.rb:405:in `__run_callback'\nactivesupport (3.2.8) lib\/active_support\/callbacks.rb:385:in `_run_process_action_callbacks'\nactivesupport (3.2.8) lib\/active_support\/callbacks.rb:81:in `run_callbacks'\nactionpack (3.2.8) lib\/abstract_controller\/callbacks.rb:17:in `process_action'\nactionpack (3.2.8) lib\/action_controller\/metal\/rescue.rb:29:in `process_action'\nactionpack (3.2.8) lib\/action_controller\/metal\/instrumentation.rb:30:in `block in process_action'\nactivesupport (3.2.8) lib\/active_support\/notifications.rb:123:in `block in instrument'\nactivesupport (3.2.8) lib\/active_support\/notifications\/instrumenter.rb:20:in `instrument'\nactivesupport (3.2.8) lib\/active_support\/notifications.rb:123:in `instrument'\nactionpack (3.2.8) lib\/action_controller\/metal\/instrumentation.rb:29:in `process_action'\nactionpack (3.2.8) lib\/action_controller\/metal\/params_wrapper.rb:207:in `process_action'\nactiverecord (3.2.8) lib\/active_record\/railties\/controller_runtime.rb:18:in `process_action'\nactionpack (3.2.8) lib\/abstract_controller\/base.rb:121:in `process'\nactionpack (3.2.8) lib\/abstract_controller\/rendering.rb:45:in `process'\nactionpack (3.2.8) lib\/action_controller\/metal.rb:203:in `dispatch'\nactionpack (3.2.8) lib\/action_controller\/metal\/rack_delegation.rb:14:in `dispatch'\nactionpack (3.2.8) lib\/action_controller\/metal.rb:246:in `block in action'\nactionpack (3.2.8) lib\/action_dispatch\/routing\/route_set.rb:73:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/routing\/route_set.rb:73:in `dispatch'\nactionpack (3.2.8) lib\/action_dispatch\/routing\/route_set.rb:36:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/routing\/mapper.rb:42:in `call'\njourney (1.0.4) lib\/journey\/router.rb:68:in `block in call'\njourney (1.0.4) lib\/journey\/router.rb:56:in `each'\njourney (1.0.4) lib\/journey\/router.rb:56:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/routing\/route_set.rb:600:in `call'\nwarden (1.2.1) lib\/warden\/manager.rb:35:in `block in call'\nwarden (1.2.1) lib\/warden\/manager.rb:34:in `catch'\nwarden (1.2.1) lib\/warden\/manager.rb:34:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/middleware\/best_standards_support.rb:17:in `call'\nrack (1.4.5) lib\/rack\/etag.rb:23:in `call'\nrack (1.4.5) lib\/rack\/conditionalget.rb:35:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/middleware\/head.rb:14:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/middleware\/params_parser.rb:21:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/middleware\/flash.rb:242:in `call'\nrack (1.4.5) lib\/rack\/session\/abstract\/id.rb:210:in `context'\nrack (1.4.5) lib\/rack\/session\/abstract\/id.rb:205:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/middleware\/cookies.rb:339:in `call'\nactiverecord (3.2.8) lib\/active_record\/query_cache.rb:64:in `call'\nactiverecord (3.2.8) lib\/active_record\/connection_adapters\/abstract\/connection_pool.rb:473:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/middleware\/callbacks.rb:28:in `block in call'\nactivesupport (3.2.8) lib\/active_support\/callbacks.rb:405:in `_run__646451992__call__371060191__callbacks'\nactivesupport (3.2.8) lib\/active_support\/callbacks.rb:405:in `__run_callback'\nactivesupport (3.2.8) lib\/active_support\/callbacks.rb:385:in `_run_call_callbacks'\nactivesupport (3.2.8) lib\/active_support\/callbacks.rb:81:in `run_callbacks'\nactionpack (3.2.8) lib\/action_dispatch\/middleware\/callbacks.rb:27:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/middleware\/reloader.rb:65:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/middleware\/remote_ip.rb:31:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/middleware\/debug_exceptions.rb:16:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/middleware\/show_exceptions.rb:56:in `call'\nrailties (3.2.8) lib\/rails\/rack\/logger.rb:26:in `call_app'\nrailties (3.2.8) lib\/rails\/rack\/logger.rb:16:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/middleware\/request_id.rb:22:in `call'\nrack (1.4.5) lib\/rack\/methodoverride.rb:21:in `call'\nrack (1.4.5) lib\/rack\/runtime.rb:17:in `call'\nactivesupport (3.2.8) lib\/active_support\/cache\/strategy\/local_cache.rb:72:in `call'\nrack (1.4.5) lib\/rack\/lock.rb:15:in `call'\nactionpack (3.2.8) lib\/action_dispatch\/middleware\/static.rb:62:in `call'\nrailties (3.2.8) lib\/rails\/engine.rb:479:in `call'\nrailties (3.2.8) lib\/rails\/application.rb:223:in `call'\nrack (1.4.5) lib\/rack\/content_length.rb:14:in `call'\nrailties (3.2.8) lib\/rails\/rack\/log_tailer.rb:17:in `call'\nrack (1.4.5) lib\/rack\/handler\/webrick.rb:59:in `service'\nc:\/Ruby193\/lib\/ruby\/1.9.1\/webrick\/httpserver.rb:138:in `service'\nc:\/Ruby193\/lib\/ruby\/1.9.1\/webrick\/httpserver.rb:94:in `run'\nc:\/Ruby193\/lib\/ruby\/1.9.1\/webrick\/server.rb:191:in `block in start_thread'\n<\/code><\/code><\/pre>\n<p><strong>Problem solved:<\/strong><\/p>\n<p>When I was creating my user model for Devise, I included email attribute in migration. Problem was there when adding devise to user model, it adds email fields by default too, so it was conflicting with my previous migration.<\/p>\n<p>I am glad that I have solved it, because I don&#8217;t have a time for these bugs. Thank you all for helping.<\/p>\n<ol>\n<li>\n<p>It looks like your user model has wrong type of attributes. Make sure your database contains valid type of fields. Learn more here: https:\/\/github.com\/plataformatec\/devise<\/p>\n<p>Your problem might be related to known case-insensitive keys issue. Add folowing snippet to your config\/initializers\/devise.rb file: http:\/\/anti-pattern.com\/case-insensitive-keys-with-devise<\/p>\n<p>Registration controller is defined in Devise library and it is automatically added to your application controllers if you add devise to the Gemfile.<\/p>\n<\/li>\n<li>\n<p>Are you submitting numerical information for some of the fields? Like, &#8220;123&#8221; for the username? That could be an issue with Devise if it is getting a number as a string, but thinking it&#8217;s actually a number.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-09 21:07:34. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I have the following error when submitting my registration information: NoMethodError in Devise::RegistrationsController#create undefined method `downcase!&#8217; for 0:Fixnum \\livu_pamatskola\\app\\views\\devise\\registrations\\new.html.erb: Re\u0123istr\u0101cija resource_name, :url =&gt; registration_path(resource_name)) do |f| %&gt; true %&gt; &#8220;button-link&#8221; %&gt; I understand that the problem is in Registrations Controller, as I think, but I don&#8217;t have a such controller. I have searched all over [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-612","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/612","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=612"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/612\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}