Schema:
action_types
------------
id
name
description
actions
-------
id
action_type_id
date
description
The goal is to copy action_types.description to actions.description only if it is not occupied yet on the UI (!).
What is done:
class ActionsController < ApplicationController
active_scaffold :action do |c|
c.columns = [ \
, :date \
, :action_type \
, :description \
]
c.columns[:action_type].form_ui = :select
c.columns[:action_type].options[:update_column] = :description
c.columns[:description].form_ui = :textarea
c.columns[:description].options = { :cols => 40, :rows => 5}
end
protected
def after_render_field(record, column)
# record: almost empty, only "action_type" is filled.
# column: column.name == "action_type"
# @params[]: id: id for the record
# But no data on UI state. So if the user wrote some lines into the
# description then it will be lost. No possibility
# to express "do nothing!"
end
#...
end
Alternatively I can accept if we do not have this functionality during "update" only on "create". Which is a half measure, but will be enough for now.
Any ideas?
(Rails 2.3.4)