Skip to content
cainlevy edited this page Sep 14, 2010 · 18 revisions

columns local

The set of columns used for the Update action. The columns themselves are not editable here – only their presence in the Update form. Note that the form automatically excludes :created_on, :created_at, :updated_on, and :updated_at.

Columns not in this set will not be accepted as input. This is to prevent hackers from sneaking unexpected data into your models.

The Update form supports subgroups. To create a subgroup, call columns.add_subgroup and pass a name and a block. The name will be used to label the subgroup in the view, and the block will let you configure the column set like normal.

Example:


config.update.columns = [:username, :password]
config.update.columns.add_subgroup "Name" do |name_group|
  name_group.add :first_name, :middle_name, :last_name
end

label local

The heading used for the Create action interface. Normally this heading is based on the core’s label.

link global local

The action link used to tie the “update” action to the List table. Most likely, you’ll use this to change the label for your link.


config.update.link.label = "Edit User"

See ApiActionLink for additional parameters for this link.

multipart local

A flag for whether the form should be multipart or not. This is typically used to support file uploads. File uploads in ActiveScaffold are still a do-it-yourself project, but this flag makes it easier.

NOTE: file uploads do not work over AJAX, so multipart = true will only be effective when the form operates in a normal fashion (when it’s loaded as a new page, not inline).

before_update_save [controller method]

If you want to add or tweak some data before the record gets saved, define this method on your controller. But first, be sure you don’t want to define a .rubyonrails.org/classes/ActiveRecord/Callbacks.html on your ActiveRecord model instead! This controller method is most useful for adding session-specific data to your model, like the current user.

Example:


class TaskController < ApplicationController
  active_scaffold :tasks
protected
def before_update_save(record)
record.updated_by = current_user
end

end

Clone this wiki locally