语法错误 - 意外的tASSOC期待tCOLON2

时间:2012-11-20 13:09:23

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

使用here

中的stiki gem

在Stiki配置部分,它表示您可以对此类特定页面进行身份验证。

stiki.authenticate_pages = :all   # other options are :only => [actions]  or :except => [actions]

我试过的是

stiki.authenticate_pages, :only => [:new]

但是我在下面得到了这个错误

C:\Users\X\Documents\GitHub\X>rails s
=> Booting WEBrick
=> Rails 3.2.8 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/act
ive_support/dependencies.rb:245:in `load': C:/Users/X/Documents/GitHub/X/config/initializers/stiki.rb:10: syntax error, unexpected tASSOC, expecting tC
OLON2 or '[' or '.' (SyntaxError)
...ki.authenticate_pages, :only => [:new]  # other options are ...
...                               ^

1 个答案:

答案 0 :(得分:4)

stiki.authenticate_pages = {:only => [:new]}

stiki.authenticate_pages :only => [:new]