This works well for me in a multi-stage environment so users can take
a screenshot of the bug and then post it to the bug tracker and I can
see straight away what version they are testing on.  First four
characters of the commit is enough in all probability.

OP:
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/53be9640c1a16faa/aa0c607502b3a059?hl=en&lnk=gst&q=owain#aa0c607502b3a059

but in summary:


/app/config/initializers/revision.rb
filename = File.expand_path('REVISION', RAILS_ROOT)
REVISION =  File.exist?(filename) ? File.read(filename) : `cd
#{RAILS_ROOT} && git rev-parse HEAD`.strip

/app/views/layout/application.html.erb
<%- unless production? %>
  <p id='revision'><%= "#{REVISION[0..3]} #{Time.now.to_s(:db)} "%></
p>
<%- end -%>

/app/helpers/application_helper.rb
  def production?
      @is_production ||=(ENV['RAILS_ENV']=='production')
  end

/public/stylesheets/content.css
        #revision {
                color: gray;
                position: absolute;
                z-index: 9;
                top: 10px;
                left: 0px;
        }

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to