Class: ActiveRecord::Base
Class Method Summary
collapse
#field, #field_for, #fieldset, included
Class Method Details
.field_for(name) ⇒ Object
5
6
7
8
|
# File 'lib/magnetic/rails.rb', line 5
def self.field_for name
name = name.to_s
fieldset[name] or generate_default_field_for(name)
end
|
.generate_default_field_for(name) ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/magnetic/rails.rb', line 10
def self.generate_default_field_for name
cname = name.to_s
m = self
raise ArgumentError, "no such column <#{ cname }>" unless columns_hash[cname]
field cname do
model m
end
end
|