Groups
Groups
Sign in
Groups
Groups
ActiveScaffold : Ruby on Rails Gem
Conversations
Labels
About
Send feedback
Help
displaying value of associated model
8 views
Skip to first unread message
slava
unread,
Sep 22, 2011, 2:06:36 AM
9/22/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ActiveScaffold : Ruby on Rails plugin
Hello,
I want to display value from associated model in a column of an
active_scaffold
class TermsController < ApplicationController
active_scaffold :terms do |config|
config.columns = [
...
:market.volume
]
end
end
class Terms < ActiveRecord::Base
has_one :market
end
What is the correct way to specify the column to show up in scaffold?
Atastor
unread,
Sep 22, 2011, 2:51:31 AM
9/22/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to actives...@googlegroups.com
Controller Terms:
...
config.columns=[...,:market_volume,...]
...
Model Terms:
def market_volume
self.market.volume
end
Atastor
unread,
Sep 22, 2011, 2:54:24 AM
9/22/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to actives...@googlegroups.com
and if you want to add a setter add the following, too:
def market_volume=(value)
self.market.volume=value
end
I intentionally left out all of the safeguards, you better insert (like nil-checks etc.).
Reply all
Reply to author
Forward
0 new messages