lib/tramway/admin/singleton_models.rb in tramway-admin-1.23.0.3 vs lib/tramway/admin/singleton_models.rb in tramway-admin-1.24
- old
+ new
@@ -4,14 +4,13 @@
def set_singleton_models(*models, project:, role: :admin)
@singleton_models ||= {}
@singleton_models[project] ||= {}
@singleton_models[project][role] ||= []
models.each do |model|
- case model.class
- when Class
- @available_models[project][role] << { model => [ :index, :show, :update, :create, :destroy ] }
- when Hash
- @available_models[project][role] << model
+ if model.class == Class
+ @singleton_models[project][role] << { model => [ :index, :show, :update, :create, :destroy ] }
+ elsif model.class == Hash
+ @singleton_models[project][role] << model
end
end
@singleton_models = @singleton_models.with_indifferent_access
end