David
unread,Jan 31, 2008, 2:30:58 PM1/31/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
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
I've defined a virtual column in my model like this:
class Contact < ActiveRecord::Base
has_many :artist_items, :class_name => "Item", :foreign_key =>
"artist_id"
has_many :buyer_items, :class_name => "Item", :foreign_key =>
"buyer_id"
def full_name_last
last_name + ", " + first_name
end
end
I want to show it in the list view as a sortable column, so I wrote
the controller like this:
class ContactController < ApplicationController
active_scaffold :contacts do |config|
config.columns =
[:full_name_last, :first_name, :middle_name, :last_name, :email, :comments, :artist_items]
config.columns[:full_name_last].label = "Contact"
columns[:full_name_last].sort_by :sql => "concat(last_name, ', ',
first_name)"
end
end
This works fine, but when I'm on the edit view, the status header at
the top of edit section says "Update#Contact0x46d5764>" instead of the
full name. When I create a column in the Item list view for the
artist, this same value appears instead of the full name.
How can I get the full name to show up properly?
Thanks
David