Sha256: 3307cd17ff324d8ecae7885a2b83fcfe33c76f400aa88a3bde19b45d5680d652
Contents?: true
Size: 1.79 KB
Versions: 96
Compression:
Stored size: 1.79 KB
Contents
<h4> </h4> <% # TODO: shouldn't this logic happen in the controller action instead of the template? # Actually, maybe we should make render :active_scaffold work in the controller, and not even have a _nested.rhtml? # This assumes that the association is included as a column in the active_scaffold_config.columns collection associated_columns = [] associated_columns = params[:associations].split(" ") unless params[:associations].nil? unless associated_columns.empty? parent_id = params[:id] associated_columns.each do | column_name | # find the column and the association column = active_scaffold_config.columns[column_name] association = column.association # determine what constraints we need if column.through_association? @constraints = { association.source_reflection.reverse => { association.through_reflection.reverse => parent_id } } else @constraints = { association.reverse => parent_id } end # generate the customized label @label = as_(:nested_for_model, :nested_model => active_scaffold_config_for(association.klass).list.label, :parent_model => format_value(@record.to_label)) begin controller = active_scaffold_controller_for(association.klass) rescue ActiveScaffold::ControllerNotFound => error concat "#{error.class} - #{error.message}" else # AST active_record.name works better concat render(:active_scaffold => controller.controller_path, :constraints => @constraints, :conditions => association.options[:conditions], :label => h(@label), :params => {:nested => true, :parent_column => column_name, :parent_model => association.active_record.name} ) end end end %>
Version data entries
96 entries across 96 versions & 1 rubygems