sferik/rails_admin — Issue #963: Request for expanded documentation for Configuring fields
Author: JohnGoodman
Created: 2012-02-06 20:36:25+00:00
State: open

Hey,

I've been using the Configuring fields section of the Railsadmin DSL article to get my project setup. The documentation says I can use configure just like I use field. However, whenever I use configure, rails_admins seems to ignore it. I'm not sure if my syntax is wrong or if rails_admin has an issue in this area. Further documentation would help clarify for people. See my code below for whats working and not working.

Rails 3.1.3
Ruby 1.9.3

This code works. It sets the user id to the current user and hides the field. Additionally, it shows the name and description field.

config.model Post do
edit do
field :name
field :description
field :user_id, :hidden do
help ""
default_value do
bindings[:view]._current_user.id
end
end
end
end

This does nothing. All fields show like there is no configuration set:

config.model Post do
edit do
configure :user_id, :hidden do
help ""
default_value do
bindings[:view]._current_user.id
end
end
end
end

Thank you.