render json: @statuses
render json: @statuses, methods: [:latitude, :longitude, :timestamp, :virtual_odometer]
default 5.940000 0.080000 6.020000 ( 6.094221) attrs 4.820000 0.010000 4.830000 ( 4.932337)
render json: @statuses.select([:latitude, :longitude, :timestamp, :virtual_odometer])
default 5.940000 0.080000 6.020000 ( 6.094221) attrs 4.820000 0.010000 4.830000 ( 4.932337) select 2.170000 0.020000 2.190000 ( 2.222277)
def self.lightning connection.select_all(select([:latitude, :longitude, :timestamp, :virtual_odometer]).arel).each do |attrs| attrs.each_key do |attr| attrs[attr] = type_cast_attribute(attr, attrs) end end end
render json: @statuses.lightning
default 5.940000 0.080000 6.020000 ( 6.094221) attrs 4.820000 0.010000 4.830000 ( 4.932337) select 2.170000 0.020000 2.190000 ( 2.222277) lightning 1.120000 0.010000 1.130000 ( 1.148763)
json 0.810000 0.020000 0.830000 ( 0.841307) yajl 0.760000 0.020000 0.780000 ( 0.809903) oj 0.640000 0.010000 0.650000 ( 0.666230)
render json: Oj.dump(@statuses.lightning, mode: :compat)
user system total real default 5.940000 0.080000 6.020000 ( 6.094221) attrs 4.820000 0.010000 4.830000 ( 4.932337) select 2.170000 0.020000 2.190000 ( 2.222277) lightning 1.120000 0.010000 1.130000 ( 1.148763) json 0.810000 0.020000 0.830000 ( 0.841307) yajl 0.760000 0.020000 0.780000 ( 0.809903) oj 0.640000 0.010000 0.650000 ( 0.666230)
Source: https://habr.com/ru/post/152719/
All Articles