You can override column_renders_as to return :subform for that column. Also you can add debug lines to the log to see what condition is true and makes the helper to return :field
logger.debug column.association.nil? logger.debug column.form_ui logger.debug active_scaffold_config_for(column.association.klass).actions.include?(:subform) logger.debug override_form_field?(column) logger.debug override_form_field(column) Regards El vie., 31 mar. 2023 17:11, Dennis Bulgatz <[email protected]> escribió: > Sergio.. I could not figure out how to get the column in the helper > > def sub_tdn_travels_*form_column*(record, input_name) > column = ?? > column_renders_as(column) > end > > Can the "caller" to this helper pass the column, or can I find it with > another api call based on the column name? > > thanks > On Friday, March 31, 2023 at 9:46:04 AM UTC-5 Dennis Bulgatz wrote: > >> Hi Sergio, >> >> Yes, I get check boxes for travels in the sub_tdn edit form. >> >> It would return :field if >> >> 1. subform action has been excluded from travels controller, >> 2. form_ui has been set for the column, or a helper >> >> >> 1. form_column has been defined for the column. >> >> >> >> None of the above are true as far as I know, but seems to be returning >> "field" in any case. Not sure how to be troubleshoot. >> >> I will try to use column_renders_as and see what it does. >> >> def sub_tdn_travels_*form_column*(record, input_name) >> column_renders_as(:travels) >> end >> >> As always, thanks! >> >> Dennis >> On Friday, March 31, 2023 at 9:06:26 AM UTC-5 [email protected] wrote: >> >>> Hi Dennis >>> >>> There is a helper method, column_renders_as, which should return >>> :subform for >>> column travels. It would return :field if subform action has been >>> excluded from >>> travels controller, form_ui has been set for the column, or a helper >>> _form_column has been defined for the column. Defining >>> sub_tdn_travels_show_column shouldn't affect. >>> >>> Was sub_tdn_travels_show_column being called in create/update form? Or >>> was it >>> displaying a list of checkboxes instead of subform? >>> >>> What method is called with the super line? Super would call another >>> method >>> with the same name, and ActiveScaffold doesn't define >>> sub_tdn_travels_form_column, so you must have defined that method >>> somewhere >>> else. >>> >>> Regards >>> >>> El jueves, 30 de marzo de 2023 0:32:39 (CEST) Dennis Bulgatz escribió: >>> > Hi Sergio, >>> > >>> > i have a resource that a column with a has_many association. >>> > >>> > For the "show" action I have a column helper that renders the children >>> as a >>> > table. >>> > >>> > def sub_tdn_travels_*show_column*(record, input_name) >>> > display_standard_table( >>> > [ >>> > { :name => 'line_item_number', :display_name => 'Item' }, >>> > { :name => 'purpose', :display_name => 'Purpose' }, >>> > { :name => 'number_of_travelers', :display_name => 'Traveler(s)' }, >>> > { :name => 'number_of_nights', :display_name => 'Night(s)' }, >>> > { :name => 'number_of_days', :display_name => 'Days(s)'}, >>> > { :name => 'from_date', :display_name => 'From'}, >>> > { :name => 'to_date', :display_name => 'To'}, >>> > { :name => 'destination', :display_name => 'Destination'} >>> > ], record.travels) >>> > end >>> > >>> > This has stopped the create/update actions on the parent from showing >>> the >>> > AS form/partial that can create new child records. >>> > >>> > Not sure what is going on, but can i restore partial with a call in >>> the >>> > helper method: >>> > >>> > def sub_tdn_travels_*form_column*(record, input_name) >>> > super(record,input_name) #THIS IS NOT RIGHT, but the idea is to use >>> > default partial >>> > end >>> > >>> > Thanks! >>> > >>> > Dennis >>> >>> >>> >>> >>> -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/activescaffold/9e2d7d57-0720-47a4-98c2-b12f9ecf0f20n%40googlegroups.com > <https://groups.google.com/d/msgid/activescaffold/9e2d7d57-0720-47a4-98c2-b12f9ecf0f20n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/activescaffold/CAF2jUs9eu22WH%2BGw-hTivn2cnsNT%3DBBn2_nPsqNjxE5RZd9QQw%40mail.gmail.com.
