简体   繁体   English

Rails 3自定义yaml文件

[英]Rails 3 custom yaml file

I want to read variables from yaml file. 我想从yaml文件中读取变量。 I tried this Railscast but it is not working because I use Rails 3.2. 我尝试了此Railscast,但由于使用Rails 3.2而无法正常工作。 Also I tried this topic again I saw that it is not working. 另外,我再次尝试了该主题 ,发现它不起作用。

How can I read some variables from custom yaml file? 如何从自定义yaml文件读取一些变量?

you can use the rails config gem as pointed out in this answer . 您可以使用此答案中指出的rails config gem

edit: fot rails 3 you better use this approach: https://stackoverflow.com/a/5053882/532102 编辑:fot rails 3,您最好使用这种方法: https : //stackoverflow.com/a/5053882/532102

I solved the problem with starting server again. 我再次启动服务器解决了问题。 However, there was an error again. 但是,再次出现错误。 The path of config file was wrong. 配置文件路径错误。 I fixed it and everything is working now. 我修好了,现在一切正常。 I used this post. 我使用了这篇文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM