I'm sorry English ..not good...
I create Money management tool.
An Item can take several tags.
---
class Item < ActiveRecord::Base
has_and_belongs_to_many :tags
end
---
class Tag < ActiveRecord::Base
has_and_belongs_to_many :items
end
---
class ItemsController < ApplicationController
active_scaffold :item do |config|
....
config.columns[:price].calculate = :sum
config.columns = [:buy_date, :tags, :name, :price]
....
end
....
....
end
---
<Example|Case no tag or 1tag(correct)>
price(item1)=1
price(item2)=2
sum => 3
<Example|Case several tags(not correct)>>
price(item1)=1 [tag1,tag2]
price(item2)=2 [tag1,tag2,tag3]
sum => 8
Why is the total extra added?
Please help!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---