Closed MaximShaikovskiy closed 2 months ago
For polymorphic associations, you'll need both the _id
column as well as a corresponding _type
column. In order to achieve this within a single select field, you might want to look into signed GlobalID -- check out this article and this GoRails episode for some ideas on how to implement.
Dull again... How to delete this issue?
Hello I get this error
t.references :documents_block, polymorphic: true, null: false
has_many :documents, as: :documents_block, dependent: :destroy
belongs_to :documents_block, polymorphic: true
Trestle.resource(:documents)build_instance do |attrs, params| if params[:information_material_and_general_rule_id] scope = ::InformationMaterialAndGeneralRule .find(params[:information_material_and_general_rule_id]) .documents else scope = ::Document end scope.new(attrs) end
form dialog: true do |document| if document.documents_block hidden_field :documents_block_id else select :documents_block_id, InformationMaterialAndGeneralRule.all end
gem 'trestle', '0.10.0.pre'