0

here語法錯誤 - 意外tASSOC期待tCOLON2

在Stiki配置部分使用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 ... 
...        ^

回答

4

這個錯誤嘗試

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

stiki.authenticate_pages :only => [:new] 
+0

感謝stiki.authenticate_pages = {:only => [:new]}正常工作,我會在5分鐘內回答 – ahmet

+0

好的:)謝謝 – Lichtamberg

相關問題