app/controllers/tramway/admin/application_controller.rb in tramway-admin-1.28.1 vs app/controllers/tramway/admin/application_controller.rb in tramway-admin-1.28.1.2
- old
+ new
@@ -82,9 +82,15 @@
def model_given?
available_models_given? || singleton_models_given?
end
def form_given?
+ # FIXME add tramway error locales to the tramway admin gem
+ #Tramway::Error.raise_error(
+ # :tramway, :admin, :application_controller, :form_given, :model_not_included_to_tramway_admin,
+ # model: params[:model]
+ #)
+ raise "Looks like model #{params[:model]} is not included to tramway-admin. Add it in the `config/initializers/tramway.rb`. This way `Tramway::Admin.set_available_models(#{params[:model]})`"
Tramway::Admin.forms.include? params[:form].underscore.sub(%r{^admin/}, '').sub(/_form$/, '')
end
def available_scope_given?
params[:scope].present? && params[:scope].in?(decorator_class.collections.map(&:to_s))