Skip to content
Basically just a fork, created to better test minor changes in docs and naming conventions. Please use the Master maintained by Keenan Brock.
Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
test
CHANGELOG
MIT-LICENSE
README
Rakefile
init.rb

README

This fork is just a copy with small cosmetically enhancements. README is modified to be more RDOC compliant, also attempted to patch some minor issues when initializing and doing proper setup in my environment.

The following is maybe only applicable to peregrine Windows user (yes, still unextincted), but despite the lack of naming conventions for rails plugins in general, the hyphen in the choosen plugin name is causing knock-on problems. One is not related to footnotes: A bug(?) in Eclipse/Radrails under Win32 currently prevents from producing docs within the GUI since Rake Tasks => doc:plugins:rails-footnotes is not visible, although OK when doing a rake -T from the command prompt within the IDE.

Easy to rename to e.g. rails_footnotes to fix this, whereby the created inconsistency with the docs is not a real issue. But when people would attempt to put footnotes into their local vendor/plugins repository and wanted this managed by GIT with a simple $ rake git:plugin:install josevalim/rails-footnotes rails_footnotes, GIT would still use the description field from the footnote rake task and put the plugin in vendor/plugins/rails-footnotes instead.

If you now rename the plugin to fix the above issue related to producing local docs, the GIT indexes (and some other references) become inconsistent and the problem starts all over.

So I renamed this helpful GEM/Plugin to rails_footnotes for testing purposes.

There is currently still some strange aka inconsistant behavior when producing docs using RDOC, Darkfish, Yardoc and Hanna with this plain README. 

DO NOT USE THIS REPOSITORY, IT IS NOT REALLY MAINTAINED AND FOR TESTING PURPOSES ONLY.  USE http://github.com/josevalim/rails-footnotes INSTEAD (!)

Some of the little setup issues I had are described below:

== Rails Footnotes
License: MIT
Version: 3.6.7

You can also read the original README in pretty html at the GitHub project Wiki page

 http://wiki.github.com/josevalim/rails-footnotes

=== Description

If you are developing in Rails you should know the plugin! It displays
footnotes in your application for easy debugging, such as sessions,
request parameters, cookies, filter chain, routes, queries, etc.

Even more, it contains links to open files directly in your editor including
your backtrace lines.

=== Installation

Installing Rails Footnotes is very easy. If you are running on Rails 2.3 just run
the following:

 sudo gem install rails-footnotes
In RAILS_ROOT/config/environments/development.rb (yes, you want it only in development):

 config.gem "rails-footnotes"
If you want it as plugin, just do:

 script/plugin install git://github.com/josevalim/rails-footnotes.git
=== Configuration

If you are not using Textmate as text editor, in your environment.rb or
in an initializer do:

 if defined?(Footnotes)
   Footnotes::Filter.prefix = 'txmt://open?url=file://%s&line=%d&column=%d'
 end
Where you are going to choose a prefix compatible with your text editor. The %s is
replaced by the name of the file, the first %d is replaced by the line number and
the second %d is replaced by the column.

For MS-Windows user: If you need the power of Textmate, you might want to look at www.e-texteditor.com
The above prefix is compatible with e, equally many of the features, abilities and bundles you know from Textmate are provided.  

By default, footnotes are appended at the end of the page with default stylesheet. If you want
to change their position, you can define a div with id "footnotes_holder" or define your own stylesheet
by turning footnotes stylesheet off:

 Footnotes::Filter.no_style = true
 # TODO: Footnotes::Filter.no_style has apparently currently no or only little effect.
 # TODO: If you define your own stylesheet and e.g. import it in your view with <%= stylesheet_link_tag 'footnotes' %>
 # the css code has precedence no matter whether Filter.no_style is set. 
 # Also the default CSS is still injected into the generated HTML by footnotes regardless. 
 # TODO: Include a sample (unobtrusive) external footnotes.css for nicer look and feel 
Another option is to allow multiple notes to be opened at the same time:

 Footnotes::Filter.multiple_notes = true
If you have New Relic RPM installed, you may want to turn off query explains
(explains can slows things down)

 Footnotes::Notes::QueriesNote.sql_explain = false
If you want to add alternate logic to enable or disable footnotes,
add something like this to your initializer:

 defined?ENABLE_RAILS_FOOTNOTES=(Rails.env.production? == false)
 # TODO: Since the constant apparently not really doing what supposed to do, you better check if the constant is not already elsewhere initialized, e.g. in config/environments/test.rb.  
 # (put all this is one common configuration YAML?)
So if you do, you better initialize this CONSTANT by putting it in test.rb as well. 
Otherwise the first plain unit test you attempt to execute against your application will likely fail.

 ENABLE_RAILS_FOOTNOTES=(Rails.env.production? == false)
 # TODO: Might also cause problems in staging environment if footnotes not properly omitted
Finally, you can control which notes you want to show. The default are:

 Footnotes::Filter.notes = [:session, :cookies, :params, :filters, :routes, :env, :queries, :log, :general]
=== Testing
The GEM/Plugin was during development successfully tested against MAC OSX and other Linux flavours.
This fork was tested against:
 ruby 1.8.7 (2010-06-23 patchlevel 299) [i386-mingw32]
 Rails 2.3.8
 Rubygems 1.3.7
The test suite executed succesfully with :
 35 tests, 72 assertions, 0 failures, 0 errors
RCOV currently not known.

=== Creating your own notes

Create your notes to integrate with Footnotes is easy.

1. Create a Footnotes::Notes::YourExampleNote class

2. Implement the necessary methods (check abstract_note.rb file in lib/notes)

3. Append your example note in Footnotes::Filter.notes array (usually at the end of your environment file or in an initializer):

For example, to create a note that shows info about the user logged in your application you just have to do:
 module Footnotes
   module Notes
     class CurrentUserNote < AbstractNote
       # This method always receives a controller
       #
       def initialize(controller)
         @current_user = controller.instance_variable_get("@current_user")
       end
       # The name that will appear as legend in fieldsets
       #
       def legend
         "Current user: #{@current_user.name}"
       end
       # This Note is only valid if we actually found an user
       # If it's not valid, it won't be displayed
       #
       def valid?
         @current_user
       end
       # The fieldset content
       #
       def content
         escape(@current_user.inspect)
       end
     end
   end
 end

Then put in your environment:

 Footnotes::Filter.notes += [:current_user]
=== Colaborators

* Leon Li       - http://github.com/scorpio
* Keenan Brock  - http://github.com/kbrock
* Ivan Storck   - http://github.com/ivanoats
* Kris Chamber  - http://github.com/kristopher

=== Bugs and Feedback

If you discover any bugs, please send an e-mail to keenan@thebrocks.net
If you just want to give some positive feedback or drop a line, that's fine too!

=== Version 3.x

This plugin was maintained until version 3.6 by José Valim

Copyright (c) 2009 José Valim (jose@plataformatec.com.br)
http://blog.plataformatec.com.br/

=== Version 2.0

This plugin was created and maintained until version 2.0 by Duane Johnson:

Copyright (c) 2006 InquiryLabs, Inc.
http://blog.inquirylabs.com/
Something went wrong with that request. Please try again.