def attr_protected?(record, column) o = instance_variable_get("@#{record}") o && o.class.protected_attributes && o.class.protected_attributes.include?(column.name.to_sym) end def default_input_block Proc.new { |record, column| options = attr_protected?(record, column) ? {:disabled => true} : {} <<-"end_html" <p> <label for="#{record}_#{column.name}">#{column.human_name}</label> <br /> #{input(record, column.name, options)} </p> end_html } end
And mark some attributes protected, for example:
class Item < ActiveRecord::Base attr_protected :created_at end
The created_at attribute will be rendered but won't be editable. This will work for "dynamic scaffolds" too!