Skip to content

Commit

Permalink
EssenceTrackIdentifierSource model does not have many essence tracks.…
Browse files Browse the repository at this point in the history
… This causes problems when deleting, because of #safe_to_delete? Updated PickList controller to load correct rjs views.
  • Loading branch information
EricR committed Apr 9, 2012
1 parent ea03533 commit ca61be6
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 23 deletions.
6 changes: 3 additions & 3 deletions app/controllers/picklists_controller.rb
Expand Up @@ -39,7 +39,7 @@ def update
@obj = @klass.find(params[:id])
@obj.update_attributes(params[@klass.to_s.underscore])
respond_to do |format|
format.js
format.js { render :partial => 'picklists/update' }
format.html { redirect_to :action => 'index' }
end
end
Expand All @@ -48,7 +48,7 @@ def create
@obj = @klass.new(params[@klass.to_s.underscore])
@obj.save
respond_to do |format|
format.js
format.js { render :partial => 'picklists/create' }
format.html { redirect_to :action => 'index' }
end
end
Expand All @@ -60,7 +60,7 @@ def destroy
@obj.destroy
end
respond_to do |format|
format.js
format.js { render :partial => 'picklists/destroy' }
format.html { redirect_to :action => 'index' }
end
end
Expand Down
6 changes: 5 additions & 1 deletion app/models/essence_track_identifier_source.rb
Expand Up @@ -4,6 +4,10 @@ class EssenceTrackIdentifierSource < ActiveRecord::Base
quick_column :name

def safe_to_delete?
essence_tracks.size == 0
# This throws an AR exception; Essence Tracks do not belong
# to Essence Tracker Identifier Sources.
#
#essence_tracks.size == 0
true
end
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 8 additions & 19 deletions db/schema.rb
Expand Up @@ -9,7 +9,14 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20120214070449) do
ActiveRecord::Schema.define(:version => 20120325210855) do

create_table "annotation_types", :force => true do |t|
t.string "name"
t.boolean "visible", :default => true
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "annotations", :force => true do |t|
t.integer "container_id"
Expand Down Expand Up @@ -49,7 +56,6 @@
t.string "attachment"
end

add_index "assets", ["id"], :name => "index_id"
add_index "assets", ["uuid"], :name => "index_assets_on_uuid", :unique => true

create_table "assets_audience_levels", :id => false, :force => true do |t|
Expand Down Expand Up @@ -256,15 +262,6 @@

add_index "essence_tracks", ["instantiation_id"], :name => "index_essence_tracks_on_instantiation_id"

create_table "exports", :force => true do |t|
t.string "status"
t.string "file"
t.integer "creator_id"
t.integer "updater_id"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "extension_names", :force => true do |t|
t.string "extension_key"
t.string "extension_authority"
Expand Down Expand Up @@ -466,14 +463,6 @@

add_index "ip_blocks", ["name"], :name => "index_ip_blocks_on_name", :unique => true

create_table "pbcore_importers", :force => true do |t|
t.string "file"
t.integer "number_of_records"
t.integer "number_of_records_processed"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "publisher_roles", :force => true do |t|
t.string "name", :null => false
t.boolean "visible", :default => false, :null => false
Expand Down

0 comments on commit ca61be6

Please sign in to comment.