Hello I'm building a small web site. Basically there are a User and a
Event models. The associations are User has_many :events and Event
belongs_to :user.
Every user can be a guest or an administrator. I've also have a method
user.is?(:role).
If a guest creates a new event it is automatically associated to it,
instead if an admin creates an event he can choose to associate it to
whoever he wants.
So I need to hide the user field if the current_user is a guest and
set its default value to
current_user.id, but if the user is an admin
he can modify the field.
I've tried this
https://github.com/sferik/rails_admin/wiki/How-to-set-default-values
but is not working for me because if I set the field as "visible
false" the value is no longer passed to the controller.
Someone knows how to solve my problem?
Thanks.