Hi Sergio,

Thanks again!

I did as you suggested using an override. 
The condition preventing the subform was:
*!active_scaffold_config_for(column.association.klass).actions.include?(:subform)*

When I removed this, I got an error

ActionView::Template::Error (Subform is not enabled. Please *enable it *or 
*remove 
any references in your configuration *(e.g. config.subform.columns = 
[...]).):

My sub_tdns controller config does not have any subform.columns defined.  
See below for the controller code.

*How do I enable the subform?  Or check what is disabling it?   It is in 
the travels_controller?  Or the sub_tdns_controller?  Or ?*

Thanks!

class SubTdnsController < ApplicationController
  active_scaffold :"sub_tdn" do |conf|
    conf.columns = [:title, :ordinal, :work_lead,
                    :pop_begin, :pop_end,
                    :introduction, :description_of_work, 
:software_classification,
                    :environment_impact, :data_sensitivity, 
:special_requirements,
                    :travels, :odcs, :gfis, :deliverables, 
:data_rights_notice ]
    conf.create.columns = [
      :travels, :odcs, :gfis, :deliverables,
      :title, :ordinal, :work_lead,
      :pop_begin, :pop_end,
      :introduction, :description_of_work, :software_classification,
      :environment_impact, :data_sensitivity, :special_requirements,
    :data_rights_notice ]

    conf.update.columns = [
      :travels, :odcs, :gfis, :deliverables,
      :title, :ordinal, :work_lead,
      :pop_begin, :pop_end,
      :introduction, :description_of_work, :software_classification,
      :environment_impact, :data_sensitivity, :special_requirements,
    :data_rights_notice ]

    conf.list.columns = :sub_tdn_number, :title
    conf.columns[:introduction].label =  "1. Introduction"
    conf.columns[:description_of_work].label =  "2. Description of Work"
    conf.columns[:software_classification].label =  "3. Software 
Classification"
    conf.columns[:environment_impact].label =  "4. Environment Impact"
    conf.columns[:data_sensitivity].label =  "5. Data Sensitivity"
    conf.columns[:special_requirements].label =  "6. Special Requirements"
    conf.columns[:travels].label =       "7. Travel Requirements"
    conf.columns[:odcs].label =          "8. Other Direct Costs"
    conf.columns[:gfis].label =          "9. Government Furnished Items"
    conf.columns[:deliverables].label=   "10. Deliverables/Milestones"
    conf.columns[:data_rights_notice].label=   "11. Data Rights Notice"

    conf.columns[:introduction].form_ui = :text_editor
    conf.columns[:description_of_work].form_ui = :text_editor
    conf.columns[:software_classification].form_ui = :text_editor
    conf.columns[:environment_impact].form_ui = :text_editor
    conf.columns[:data_sensitivity].form_ui = :text_editor
    conf.columns[:special_requirements].form_ui = :text_editor
    conf.columns[:data_rights_notice].form_ui = :text_editor

    conf.action_links.add 'get_pdf', :type => :member, controller: 
:sub_tdns, action: :show, page: true, :parameters => {format: :pdf}

    #conf.show.link.page = true
  end

On Friday, March 31, 2023 at 2:23:30 PM UTC-5 [email protected] wrote:

> 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/4fc22794-71e8-40e6-bfbc-f4dc77e4adb4n%40googlegroups.com.

Reply via email to