Module: TkInspect::Console::RailsConsole
- Extended by:
- ActiveSupport::Concern
- Included in:
- Base
- Defined in:
- lib/tk_inspect_rails/console/rails_console.rb
Instance Method Summary collapse
- #create_sql_panel_menu ⇒ Object
- #open_sql_panel ⇒ Object
-
#rails_console ⇒ Object
Loads the Rails console into the current TkConsole Inspired by github.com/cldwalker/ripl-rails/blob/master/lib/ripl/rails.rb.
Instance Method Details
#create_sql_panel_menu ⇒ Object
6 7 8 9 10 11 |
# File 'lib/tk_inspect_rails/console/rails_console.rb', line 6 def tools = @menu[:tools] tools.add :separator tools.add :command, label: "SQL Panel", accelerator: 'Command+l', command: -> { open_sql_panel } @tk_root.tk_item.native_item.bind('Command-l', -> { open_sql_panel }) end |
#open_sql_panel ⇒ Object
17 18 19 |
# File 'lib/tk_inspect_rails/console/rails_console.rb', line 17 def open_sql_panel TkInspectRails::SqlPanel::Base.new.refresh end |
#rails_console ⇒ Object
Loads the Rails console into the current TkConsole Inspired by github.com/cldwalker/ripl-rails/blob/master/lib/ripl/rails.rb
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tk_inspect_rails/console/rails_console.rb', line 23 def rails_console say 'Loading Rails console...' Tk.update require "#{Dir.pwd}/config/boot" if File.exists?("#{Dir.pwd}/config/application.rb") Object.const_set :APP_PATH, File.("#{Dir.pwd}/config/application") require APP_PATH require 'rails/console/app' require 'rails/console/helpers' if defined?(Rails::ConsoleMethods) self.class.include Rails::ConsoleMethods end ::Rails.application.require_environment! else ["#{Dir.pwd}/config/environment", 'console_app', 'console_with_helpers'].each {|e| require e } end say 'Rails console loaded!' end |