How can I specify available ActiveScaffold actions on a per-record basis?
-
30-10-2019 - |
Вопрос
I have a very simple admin controller in my Rails 2 app that displays all the records for a model read-only:
class Admin::InspectionsController < ApplicationController
active_scaffold :inspections do |config|
[:create, :update, :delete].each {|a| config.actions.exclude a}
config.actions.exclude :nested
end
end
I wish to make these model objects editable, but only if they are in a certain state (ie, before they've been approved). I can do this for all Inspections
by removing :update from the exclusions list, but I don't want to enable editing wholesale.
Is there a way to specify conditional actions to ActiveScaffold?
Нет правильного решения
Не связан с StackOverflow