El miércoles, 8 de noviembre de 2017 18:57:47 (CET) Jim escribió:
> Currently I have a column set up like this:
> 
>     columns[:delivery_method].form_ui = :select
>     columns[:delivery_method].options = {options: ['', 'hand-delivered',
> 'shipped']}
> 
> I would like to populate the delivery method with a user-editable list.
> However, if I use something like:
> 
>     columns[:delivery_method].options = {options: List.delivery_methods}
> 
> where List.delivery_methods returns an array of the options the user has
> specified, will the configuration update? I haven't tried this yet, but I
> think the configuration is cached in production?

No, configuration is evaluated when class is loaded, so only on app start 
(although 
development mode reloads class in every request).

To make dynamic options for select, you can define active_scaffold_enum_options 
helper:
https://github.com/activescaffold/active_scaffold/wiki/Enum-Columns

> 
> I know I could do what I need using an override, but figured I'd ask and
> see if there was a way to update the configuration.

Also, you could change options with before_action in each request, but 
per-request 
configuration can cause issues, probably not in this case, but IMHO helpers are 
better 
than changing configuration with before_action. 

I'm working in making ActiveScaffold threadsafe, which will solve per-request 
configuration issues, but still I think helpers are better.

> 
> Thanks,
> Jim Crate


-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/activescaffold.
For more options, visit https://groups.google.com/d/optout.

Reply via email to