Rails在视图中帮助SyntaxError

时间:2011-04-24 16:20:00

标签: ruby-on-rails ruby ruby-on-rails-3

我在视图中收到此错误:

SyntaxError in PublicController#fast

C:/Rails/konkurranceportalen/app/controllers/public_controller.rb:11: syntax error, unexpected tASSOC, expecting keyword_end
@titel => 'Heading'
         ^\

我在控制器中的动作:

def fast
render :template => 'kategoris/show', :layout => 'kategori'
@titel => 'Heading'
@konkurrancers = Konkurrancer.where('type', 'nyhedsbrev')
end

1 个答案:

答案 0 :(得分:4)

你只想要@titel = 'Heading'=>用于构建Hash es,如`foo = {:a => 1,:b => “棒”}