I'd like to start off saying I know there are other questions on here about this however none of them are using rails 4 and I could not get their suggestions to work. The error I am getting is "uninitialized constant HomeController"
code in index.html.erb
<%if user_signed_in? %>
<p align= "right">Hello <%=current_user.email %> <%= link_to "sign out", destroy_user_session_path, :method => :delete %></p>
Here are the first 3 lines to application.html.erb
<!DOCTYPE html>
<html>
<%= javascript_include_tag :defaults %>
I'm thinking it might have something to do with this line in my routes.rb file
root 'home#index'
Thanks in advance
you dont have home controller at app/controllers/
you should create app/controllers/home_controller.rb with:
class HomeController < ApplicationController
def index
end
end
for your second error: you call method email for nil(not post).
问题出在我的routes.rb文件中,它应该读为“ posts#index”而不是“ home#index”
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.