I am trying to have a virtual column display the count of the records
in a nested scaffold but I get the object id along with the count, how
do I correct this?
model\ticker.rb
class Ticker < ActiveRecord::Base
has_many :ratios
has_many :summaries
def year_count
ratios.count(:period, :group=>'ticker')
end
end
controllers\tickers_controller.rb
class TickersController < ApplicationController
layout "application"
active_scaffold :ticker do |config|
config.actions = [:create, :update, :show, :list, :search, :nested]
config.columns =
[:id, :cik, :ticker, :name,:year_count, :ratios, :summaries]
config.list.columns = [:cik, :ticker, :name, :year_count]
config.nested.add_link("Ratios", [:ratios])
config.nested.add_link("10yr Summary", [:summaries])
end
end
The column year_count is included in the list but is shown as #<Ticker:
0xb6120e60>10 - is this case 10 is the correct count, but how do I
drop the #<Ticker.....>
Thanks,
Jordan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---