Here’s my setup:
In migration file:
…
t.column :perm0, :int, :default => User::Perms::Base, :null => false
…
(User::Perms:Base = 1)
In app/views/login/add_user.rhtml:
…
Permissions:
<%= form.text_field :perm0, :size => 10 %>
…
While (quite magically), provides me with a form with the default
value “1” helpfully prefillled.
The fly in the ointment is that, should I decide on a more interesting
default, I’m going to want the value displayed zero-filled in hex
(%08x instead of %d). Any ideas?
===
Alternatively, I could go with a checkbox system, with the checkboxes
preset according to the default. Where is the magic that pulls this
data out of the db?