Home > Blockchain >  ActionView::Template::Error (undefined method `email' for #<User id: nil, name: nil, created
ActionView::Template::Error (undefined method `email' for #<User id: nil, name: nil, created

Time:11-03

Hello and Thanks for anyone who can help me i'm desperate So I'm not sure what it is. On local host all works fine.

I have got this error in Heroku.

2022-10-28T02:39:55.334817 00:00 heroku[router]: at=info method=POST path="/users/sign_out" host=safe-refuge-37059.herokuapp.com request_id=56fb576b-3bb2-4a73-81e9-d7e8fecc4063 fwd="157.100.88.123" dyno=web.1 connect=0ms service=9ms status=302 bytes=1060 protocol=https 2022-10-28T02:40:20.470191 00:00 heroku[router]: at=info method=GET path="/users/sign_up" host=safe-refuge-37059.herokuapp.com request_id=0601e31b-0cf4-4714-a8ef-e41257302a21 fwd="157.100.88.123" dyno=web.1 connect=0ms service=12ms status=500 bytes=1827 protocol=https 2022-10-28T02:40:20.456799 00:00 app[web.1]: I, [2022-10-28T02:40:20.456735 #4]  INFO -- : [0601e31b-0cf4-4714-a8ef-e41257302a21] Started GET "/users/sign_up" for 157.100.88.123 at 2022-10-28 02:40:20  0000 2022-10-28T02:40:20.457567 00:00 app[web.1]: I, [2022-10-28T02:40:20.457512 #4]  INFO -- : [0601e31b-0cf4-4714-a8ef-e41257302a21] Processing by Devise::RegistrationsController#new as HTML 2022-10-28T02:40:20.464719 00:00 app[web.1]: I, [2022-10-28T02:40:20.464666 #4]  INFO -- : [0601e31b-0cf4-4714-a8ef-e41257302a21]   Rendered devise/registrations/new.html.erb within layouts/application (Duration: 5.9ms | Allocations: 5404) 2022-10-28T02:40:20.464772 00:00 app[web.1]: I, [2022-10-28T02:40:20.464744 #4]  INFO -- : [0601e31b-0cf4-4714-a8ef-e41257302a21]   Rendered layout layouts/application.html.erb (Duration: 6.0ms | Allocations: 5434) 2022-10-28T02:40:20.464916 00:00 app[web.1]: I, [2022-10-28T02:40:20.464886 #4]  INFO -- : [0601e31b-0cf4-4714-a8ef-e41257302a21] Completed 500 Internal Server Error in 7ms (Allocations: 5991) 2022-10-28T02:40:20.465659 00:00 app[web.1]: F, [2022-10-28T02:40:20.465619 #4] FATAL -- : [0601e31b-0cf4-4714-a8ef-e41257302a21]    2022-10-28T02:40:20.465660 00:00 app[web.1]: [0601e31b-0cf4-4714-a8ef-e41257302a21] ActionView::Template::Error (undefined method `email' for #\<User id: nil, name: nil, created_at: nil, updated_at: nil\>):
2022-10-28T02:40:20.465661 00:00 app\[web.1\]: \[0601e31b-0cf4-4714-a8ef-e41257302a21\]     11:
2022-10-28T02:40:20.465661 00:00 app\[web.1\]: \[0601e31b-0cf4-4714-a8ef-e41257302a21\]     12:   \<div \>
2022-10-28T02:40:20.465662 00:00 app\[web.1\]: \[0601e31b-0cf4-4714-a8ef-e41257302a21\]     13:     \<%= f.label :email %\>

2022-10-28T02:40:20.465662 00:00 app\[web.1\]: \[0601e31b-0cf4-4714-a8ef-e41257302a21\]     14:     \<%= f.email_field :email, autofocus: true, autocomplete: "email" %\>
2022-10-28T02:40:20.465663 00:00 app\[web.1\]: \[0601e31b-0cf4-4714-a8ef-e41257302a21\]     15:   \</div\>
2022-10-28T02:40:20.465663 00:00 app\[web.1\]: \[0601e31b-0cf4-4714-a8ef-e41257302a21\]     16:
2022-10-28T02:40:20.465663 00:00 app\[web.1\]: \[0601e31b-0cf4-4714-a8ef-e41257302a21\]     17:   \<div \>
2022-10-28T02:40:20.465664 00:00 app\[web.1\]: \[0601e31b-0cf4-4714-a8ef-e41257302a21\]  
2022-10-28T02:40:20.465664 00:00 app\[web.1\]: \[0601e31b-0cf4-4714-a8ef-e41257302a21\] app/views/devise/registrations/new.html.erb:14
2022-10-28T02:40:20.465664 00:00 app\[web.1\]: \[0601e31b-0cf4-4714-a8ef-e41257302a21\] app/views/devise/registrations/new.html.erb:3

the problem seens to be on devise but i cannot find where

this is my aplication.html.erb where i think the problem could be``

`

\<!DOCTYPE html\>
\<html\>
\<head\>
\<title\>BudgetApp\</title\>
\<%= csrf_meta_tags %\>

    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>

\</head\>

\<body\>

    <%= yield %>

\</body\>
\</html\>

`

and this is the render from devise where the problem seens to start

<h2 \>Log in User\</h2\>

\<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %\>
\<div \>
\<%= f.label :email %\>\<br /\>
\<%= f.email_field :email, autofocus: true, autocomplete: "email" %\>
\</div\>

\<div \>
\<%= f.label :password %\>\<br /\>
\<%= f.password_field :password, autocomplete: "current-password" %\>
\</div\>

\<% if devise_mapping.rememberable? %\>
\<div \>
\<%= f.check_box :remember_me %\>
\<%= f.label :remember_me %\>
\</div\>
\<% end %\>

\<div \>
\<%= f.submit "Log in", :class =\> 'btn-form' %\>

\</div\>

\<% end %\>
\<div \>
\<%= render "devise/shared/links" %\>
\</div\>

i will apreciate help. https://infinite-forest-50155.herokuapp.com this is the app. y press the log out button but in the log there are no errors, but when i click on sign in or log in the same error appears

I try to Look on Related Issues on stackoverflow but any error seens to be related to mine. y modify enviroment on local proyect to see if works. my local proyect works perfectly so i dont know what to do.

CodePudding user response:

Thanks a lot for the Idea! in model, there is not Email field because I´m using devise. but the problem was the database migrations, i created the create user DB and after i make a remove a column from that DB, but when I upload the migration to Heroku, it only migrates the creations and not the remove so that caused a problem in the DB

  • Related