Add methods to `rails console`
module SailboatGuide | |
class Application < Rails::Application | |
console do | |
require 'console_helpers' | |
TOPLEVEL_BINDING.eval('self').extend ConsoleHelpers | |
end | |
end | |
end |
# Helper methods for `rails console` | |
# | |
#. $ rails console | |
# >> s = slug 'pacific-seacraft/25' | |
# => #<Sailboat:0x00007fa2a4339480 ...> | |
# | |
module ConsoleHelpers | |
def slug(path) | |
Slug.by_path(path) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment