[英]User login trouble with Chapter 9 Ruby on Rails 2 Tutorial
I'm not quite sure what went wrong however I have seemed to mess something up after working out of Ch. 我不太确定出了什么问题,但是在Ch锻炼之后,我似乎有些混乱。 9 Ruby on Rails 3 Tutorial (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book) 9 Ruby on Rails 3教程(http://ruby.railstutorial.org/ruby-on-rails-tutorial-book)
This chapter walks you through the Sign In and Sign Out features of the site. 本章将引导您完成网站的“登录”和“注销”功能。 I had the Sign In method working properly, but now the application will not run. 我的登录方法正常运行,但是现在该应用程序将无法运行。
If I take out the last "end" from the ApplicationHelper, the error changes from "NoMethodError in Pages#home" to "SyntaxError in PagesController#home" 如果我从ApplicationHelper中取出最后一个“结束”,则错误将从“ Pages#home中的NoMethodError”更改为“ PagesController#home中的SyntaxError”。
module ApplicationHelper
def logo
image_tag("logo.png", :alt => "Sample App", :class => "round")
end
#Return a title on a per-page basis
def title
base_title = "Sample App"
if @title.nil?
base_title
else
"#{base_title} | #{@title}"
end
end
end
or 要么
module ApplicationHelper
def logo
image_tag("logo.png", :alt => "Sample App", :class => "round")
end
#Return a title on a per-page basis
def title
base_title = "Sample App"
if @title.nil?
base_title
else
"#{base_title} | #{@title}"
end
end
Pages Controller 页面控制器
class PagesController < ApplicationController
def home
@title = "Home"
end
def contact
@title = "Contact"
end
def about
@title = "About"
end
def help
@title = "Help"
end
end
I appologize if this is a vague description, I've been working on this for a few days now and I have not been able to figure out what I did wrong. 如果这是一个模糊的描述,我表示歉意,我已经为此工作了几天,但我一直无法弄清楚我做错了什么。 Please let me know if there is any more information that I can provide 请让我知道我是否可以提供更多信息
如果我正确记住该章的内容,请检查是否在PagesController中定义了“主页”操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.