how to embed raw html in active_admin formtastic

后端 未结 3 814
我寻月下人不归
我寻月下人不归 2020-12-18 08:37

I\'m trying to build a form, with formtastic, inside an active_admin model. The problem is I need a certain script tag and other raw HTML stuff directly inside or around the

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-18 08:58

    Active admin created a DSL on top of Formtastic according to their docs

    https://github.com/activeadmin/activeadmin/blob/master/docs/5-forms.md

    So you can now do:

    form do |f|
      f.semantic_errors(*f.object.errors.keys)
    
      import_errors = self.controller.instance_variable_get("@errors")
      if import_errors.present?
        ul class: 'errors' do
          import_errors.each do |e|
            li e
          end
        end
      end
     # ...
    end
    

提交回复
热议问题