我不太清楚究竟出了什麼問題,但是我在完成Ch之後似乎已經搞亂了一些東西。 9 Ruby on Rails 3教程(http://ruby.railstutorial.org/ruby-on-rails-tutorial-book)第9章Ruby on Rails用戶登錄問題2教程
本章將引導您完成網站的登錄和退出功能。我的登錄方法正常工作,但現在應用程序不能運行。
如果我拿出從ApplicationHelper,從 「NoMethodError在頁面#家」 的錯誤改變過去的 「結束」 到 「的SyntaxError在PagesController#家」
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
或
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
頁控制器
class PagesController < ApplicationController
def home
@title = "Home"
end
def contact
@title = "Contact"
end
def about
@title = "About"
end
def help
@title = "Help"
end
end
我appologize如果這是一個模糊的描述,我已經工作Ø在這幾天現在,我一直無法弄清楚我做錯了什麼。請讓我知道是否有任何我可以提供的更多信息
你的第一個版本似乎沒問題,你的蹤跡是什麼? – apneadiving
應用程序跟蹤顯示:app/controllers/application_controller.rb:1 app/controllers/pages_controller.rb:1 –
所以它似乎錯誤在於控制器,而不是幫手 – apneadiving