Module: RailsDb::Connection
- Defined in:
- lib/rails_db/connection.rb
Instance Method Summary collapse
- #column_names ⇒ Object
- #column_properties ⇒ Object
- #columns ⇒ Object
- #connection ⇒ Object
- #to_param ⇒ Object
Instance Method Details
#column_names ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rails_db/connection.rb', line 49 def column_names Debuggers.print '26. Starting column_names method' begin result = columns.collect(&:name) Debuggers.print "27. column_names result: #{result.inspect}" result rescue => e Debuggers.print "28. Error in column_names: #{e.message}" Debuggers.print e.backtrace raise end end |
#column_properties ⇒ Object
41 42 43 |
# File 'lib/rails_db/connection.rb', line 41 def column_properties %w(name sql_type null limit precision scale type default) end |
#columns ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rails_db/connection.rb', line 28 def columns Debuggers.print '23. Starting columns method' begin result = connection.columns(name) Debuggers.print "24. columns result: #{result.inspect}" result rescue => e Debuggers.print "25. Error in columns: #{e.message}" Debuggers.print e.backtrace raise end end |
#connection ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rails_db/connection.rb', line 4 def connection Debuggers.print '17. Starting connection method' begin result = ActiveRecord::Base.connection Debuggers.print "18. connection result: #{result}" result rescue ActiveRecord::ConnectionNotEstablished => e Debuggers.print "19. Connection not established, trying to establish connection" begin result = ActiveRecord::Base.establish_connection(Rails.application.config.database_configuration[Rails.env]).connection Debuggers.print "20. New connection established: #{result}" result rescue => e Debuggers.print "21. Error establishing connection: #{e.message}" Debuggers.print e.backtrace raise end rescue => e Debuggers.print "22. Error in connection: #{e.message}" Debuggers.print e.backtrace raise end end |
#to_param ⇒ Object
45 46 47 |
# File 'lib/rails_db/connection.rb', line 45 def to_param name end |