开发者

Rails application information

I want to store some information about my rails application, like a version number. I am new to rails and I'm sure there is some sort of convention for doing this. What is the best method of doing this, maybe the environ开发者_JAVA百科ments file?


not sure if it is 'best practice' but I also put mine in the environment.rb as a constant

and I am using SVN source control with a propset to update the revision number in the file upon checkin

# environment.rb
APPLICATION_VERSION = '1.3.0.$Revision: 203 $'

the only downside to this is that you must modify this file to get the revision to update, regular commits to other files will not cause the update

for display in the view

# application_helper.rb
def application_version
  return APPLICATION_VERSION.gsub('$Revision: ', '').gsub(' $', '')
end

kinda funky but it works

info on svn propset svn:keywords "Revision" - if interested?

http://blog.taragana.com/index.php/archive/how-to-add-revision-number-id-automatically-to-subversion-files-in-two-simple-steps/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜