使用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 ...
... ^
答案 0 :(得分:4)
试
stiki.authenticate_pages = {:only => [:new]}
或
stiki.authenticate_pages :only => [:new]