rails activerecord-sqlserver-adapter - (对象不支持#inspect)

时间:2017-06-27 19:28:52

标签: ruby-on-rails sql-server activerecord

我的应用程序正在经历从MySQL到MSSQL的转换。我们使用rails 3.2.22和activerecord-sqlserver-adapter 3.2.16。

在rails控制台中运行以下内容时:

irb(main):008:0* f = F5Device.first
  F5Device Load (6.1ms)  EXEC sp_executesql N'SELECT TOP (1) [dbo].[f5_devices].* FROM [dbo].[f5_devices]'
=> #<F5Device id: 5422, name: "VMIKSA69901MEM", environment: "UAT", feed_type_id: 1, scm_device_id: 121764, created_at: "2012-08-24 01:02:52", updated_at: "2017-01-19 16:08:08", gonefishing: 0>
irb(main):009:0> f.members
(Object doesn't support #inspect)
=>

f.members的来电回复(Object doesn't support #inspect)

关系:

class F5Device < F5Base
      has_many :nodes, :class_name => "F5Node", :foreign_key => "device_id"
      has_many :members, :through => :nodes
      has_many :group_items , :foreign_key => :device_id
      has_many :groups, :through => :group_items
      has_many :dependencies, :class_name => "Dependency", :foreign_key => :device_id
      has_many :device_applications, :class_name => "F5DeviceApplication", :foreign_key => :device_id
      has_many :applications, :through => :device_applications
      has_many :websphere_servers, :class_name => "IisDependency", :foreign_key => :f5_device_id

    def pools
         members = self.members
         pools = []
         members.each do |m|
           pools << m.pool
         end
         pools
    end

class F5Node < F5Base
      has_many :bigips, :class_name => "F5Bigip", :foreign_key => :group_id, :primary_key => :group_id
      belongs_to :device, :class_name => "F5Device", :foreign_key => :device_id
      has_many :members, :class_name => "F5Member", :foreign_key => "node_id", :dependent => :destroy
      has_many :pools, :through => :members
      attr_accessor :ws, :bigip, :session_status, :monitor_status, :enabled_status, :status_description, :availability_status, :state
      after_initialize :set_ws


class F5Member < F5Base
      belongs_to :pool, :class_name => "F5Pool", :foreign_key => "pool_id"
      belongs_to :node, :class_name => "F5Node", :foreign_key => "node_id"
      has_one :websphere, :class_name => "IisDependency", :foreign_key => "f5_member_id"
      attr_accessor :ws, :bigip, :session_state, :session_status, :monitor_status, :statistics,:state

0 个答案:

没有答案