ruby on rails - ActiveRecord::RecordNotFound / Couldn't find Maker with 'id'=1 -
i might've erased user information (:maker_id, :name, , :password) when did rake db:reset in terminal, going 'localhost:3000' '/' gives me error:
activerecord::recordnotfound in pagescontroller#home
couldn't find maker 'id'=1
extracted source (around line #7):
6 def current_user
7 @current_user ||= maker.find(session[:maker_id]) if session[:maker_id]
8 end
9 helper_method :current_user
my application controller has:
class applicationcontroller < actioncontroller::base protect_from_forgery with: :exception def current_user @current_user ||= maker.find(session[:maker_id]) if session[:maker_id] end helper_method :current_user def authorize redirect_to '/' unless current_user end end
my pages controller has empty
def home end
my pages home.html.erb view has:
<div class='text-center'> <h1>welcome venture</h1> <br><br> <%= link_to "signup", '/signup', class: 'btn btn-success' %> or <%= link_to "login", '/login', class: 'btn btn-primary' %> </div>
my layouts application.html.erb view has:
<body class="containter"> <div class='pull-right'> <% if current_user %> logged in <%= current_user.name %> | <%= link_to "logout", '/logout' %> <% else %> <%= link_to "signup", '/signup'%> or <%= link_to "login", '/login' %> <% end %> </div> <h1><%= link_to 'venture', '/' %></h1> <% flash.each |type, message| %> <div class="alert alert-info fade in"> <button class="close" data-dismiss="alert">×</button> <%= message %> </div> <% end %> <%= yield %> </body>
it used work before db:reset runs db:drop db:setup believe. create users through signup page cannot there.
any insight appreciated.
these records not available more - when db:drop
executed, of them have been removed. operation can not undone
, @ moment options have restore db either manually or automatically if have access backup.
Comments
Post a Comment