Method: Engine2::ActionModelSupport#node_defined
- Defined in:
- lib/engine2/action.rb
#node_defined ⇒ Object
while prnt && prnt.*.assets[:model] == model
prnt = prnt.parent
end
m = prnt.*.assets[:model]
m ? m.name : nil
end
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 |
# File 'lib/engine2/action.rb', line 354 def node_defined super # p_model_name = parent_model_name model = @assets[:model] at = action_type case at when :list, :star_to_many_list, :star_to_many_link_list, :star_to_many_field, :star_to_many_field_link_list # :many_to_one_list model.many_to_one_associations.each do |assoc_name, assoc| unless assoc[:propagate] == false # || p_model_name == assoc[:class_name] dc = model.type_info[assoc[:keys].first][:decode] node.run_scheme :decode, model, assoc_name, dc[:search] end end end case at when :modify, :create model.many_to_one_associations.each do |assoc_name, assoc| unless assoc[:propagate] == false # || p_model_name == assoc[:class_name] dc = model.type_info[assoc[:keys].first][:decode] node.run_scheme :decode, model, assoc_name, dc[:form] end end end case at when :list #, :star_to_many_list, :many_to_one_list # list dropdowns model.one_to_many_associations.merge(model.many_to_many_associations).each do |assoc_name, assoc| unless assoc[:propagate] == false node.run_scheme :star_to_many, :"#{assoc_name}!", assoc end end end case at when :modify, :create model.type_info.each do |field, info| case info[:type] when :blob_store node.run_scheme :blob_store, model, field when :foreign_blob_store node.run_scheme :foreign_blob_store, model, field when :file_store node.run_scheme :file_store, model, field when :star_to_many_field assoc = model.association_reflections[info[:assoc_name]] # info[:name] ? raise E2Error.new("Association '#{info[:assoc_name]}' not found for model '#{model}'") unless assoc node.run_scheme :star_to_many_field, assoc, field end end end end |