Changeset 2
- Timestamp:
- 07/17/2006 03:42:02 AM (2 years ago)
- Files:
-
- trunk/auto-admin/lib/auto_admin_controller.rb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/auto-admin/lib/auto_admin_controller.rb
r1 r2 121 121 122 122 # Save child objects 123 # FIXME: This is currently quite entirely broken. At least it 124 # isn't preventing the main object from being saved, so it should 125 # be okay for read-only lists. 123 126 model.admin_fieldsets.each do |set| 124 127 case set.fieldset_type … … 126 129 children = @object.send( set.field ) 127 130 child_class = children.build.class 128 child_params = params[ params[:model].to_s + '_' + set.field.to_s]131 child_params = params["#{params[:model]}_#{set.field}"] 129 132 child_params.each do |child_index, child_info| 133 next unless Hash === child_info 130 134 o = child_info[:id] ? child_class.find( child_info[:id] ) : children.build 131 child_info.delete :id 132 if set.field_options.all? {|k,v| v[:required] ? child_info[k].blank? : true } 133 o.destroy 134 else 135 unless o.update_attributes child_info 136 render :action => 'edit' and return 137 end 135 # child_info.delete :id 136 unless o.update_attributes child_info 137 render :action => 'edit' and return 138 138 end 139 139 end if child_params … … 201 201 202 202 filename = roots.map {|dir| File.join( dir, params[:path] ) }.detect {|file| File.exist?( file ) } 203 render :text => File.read(filename), :content_type => mime_type 203 raise "Unable to locate asset #{File.join(params[:path]).inspect} in any of #{roots.size} asset roots" unless filename 204 205 # FIXME: Should we do this in develpment mode? "Development" 206 # generally means of the application, but what if we're working on a 207 # theme? 208 @headers['Expires'] = (Time.now + 1.day).utc.to_formatted_s(:rfc822) 209 210 send_file filename, :type => mime_type 204 211 end 205 212 end
