samvera-deprecated / sufia

[DEPRECATED] Sufia: a fully featured, flexible Samvera repository front-end.
http://sufia.io/
Other
111 stars 78 forks source link

Generating new concern changes `primary_work_type` #3006

Open atz opened 7 years ago

atz commented 7 years ago

The work_generator does:

      inject_into_file 'config/initializers/sufia.rb', after: "Sufia.config do |config|\n" do
        "  # Injected via `rails g sufia:work #{class_name}`\n" \
        "  config.register_curation_concern :#{file_name}\n"
      end

The important part there is that each work that gets generated is inserted above the others at the top of the config block, changing what primary_work_type returns (via .first).

I'm fairly confident that a user who generates a new type after years of stable operation would be surprised to find features behaving differently and code that suggests the new type is now "primary".

IMHO, we should get rid of primary_work_type altogether.

atz commented 7 years ago

Shorter-term fix would be change the generator to append after any other already generated types.

mjgiarlo commented 7 years ago

:+1: to considering ditching primary_work_type. At a cursory glance, it's only used in a handful of spots in the code.