Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Every Rails page has footnotes that gives information about your application and links back to your editor
Ruby Shell
branch: master

This branch is 10 commits ahead, 295 commits behind josevalim:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib
test
CHANGELOG
MIT-LICENSE
README
Rakefile
init.rb
rails-footnotes.gemspec

README

Rails Footnotes
License: MIT
Version: 3.6.2

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

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

You may want to see this blog post about Linux Version

  http://blog.siverti.com.br/2008/11/29/rails-footnotes-full-linux-support-footnotes-for-linux/

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
------------

If you are running Linux and using gedit as default editor you can use rails-footnotes

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

   gem sources -a http://gemcutter.org
   sudo gem install rails-footnotes-linux

* Note if you already have gemcutter gem installed and configured you don't need
  to execute the first command.

After normal gem installation described above, in a terminal run (without sudo):

    rails-footnotes-linux-configure

In RAILS_ROOT/config/environments/development.rb (yes, you want it only in development):

  config.gem "lexrupy-rails-footnotes-linux",  :lib => "rails-footnotes", :source => "http://gems.github.com"

If you want it as plugin, just do:

   script/plugin install git://github.com/lexrupy/rails-footnotes.git

If you are running on Rails 2.2 or Rails 2.1 you should do:

    cd myapp
    git clone git://github.com/lexrupy/rails-footnotes.git vendor/plugins/rails-footnotes
    cd vendor/plugins/rails-footnotes
    git checkout VERSION_NUMBER
    rm -rf ./.git

Where you should replace VERSION_NUMBER for "v3.3.2" for Rails 2.2 and "v3.2.2"
for Rails 2.1 (without the quotes).


Note that if you want to use as a plugin, you still need to run the command:

    rails-footnotes-linux-configure

You only need to do this once, in other projects you can just require the gem or
install the plugin.


After theese steps you should be able to click on links created by footnotes plugin and Gedit should open. If you use Firefox 3 or newer, first time you click on a link it will ask you a confirmation to open txmt url with the txmt_handler, click yes and it's all done.


* If for some reason urls not work just after instalation, try to refresh your gnome session (logout and login again).


* After a updating the gem, please run the configure command again.

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. You can also enable this behaviour in other
editors following the steps in the link below:

  http://josevalim.blogspot.com/2008/06/textmate-protocol-behavior-on-any.html

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

Another option is to allow multiple notes to be opened at the same time:

  Footnotes::Filter.multiple_notes = true

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]


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 jose.valim@gmail.com
If you just want to give some positive feedback or drop a line, that's fine too!

Copyright (c) 2009 José Valim (jose.valim@gmail.com)
http://josevalim.blogspot.com/


For linux version please fill bugs at github issues page.


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.