Accessing config from application.rb in Controller (Rails 3)

前端 未结 5 1135
情书的邮戳
情书的邮戳 2020-12-23 10:47

I\'m trying to add two extra config options to my application.rb so I can read them out in controllers.

# Extra
config.twitter.key = \'foo\'
config.twitter.s         


        
5条回答
  •  自闭症患者
    2020-12-23 11:15

    A small update to the widely accepted answer here : Accessing config from application.rb in Controller (Rails 3)

    The methods inside the module TwitterConfig should be class methods (or module methods if you prefer it that way). They can't be instance methods.

    Sorry to put this in an answer, but I could not find a way to comment on that answer.

提交回复
热议问题