0

从这里使用 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 ...
...                               ^
4

1 回答 1

4

尝试

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

或者

stiki.authenticate_pages :only => [:new]
于 2012-11-20T13:11:59.860 回答