Skip to content

Commit

Permalink
Handle create & update actions for visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 committed Aug 29, 2024
1 parent b78d5f8 commit 3479316
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/madmin/field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def visible?(action)
case action
when :index
default_index_attributes.include?(attribute_name)
when :new, :edit
when :new, :create, :edit, :update
# Hidden attributes for forms
[:id, :created_at, :updated_at].exclude?(attribute_name)
else
Expand Down
2 changes: 2 additions & 0 deletions lib/madmin/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def attribute(name, type = nil, **options)
if config.has_key?(:form)
value = config.delete(:form)
config.new = value
config.create = value
config.edit = value
config.update = value
end

attributes[name] = OpenStruct.new(
Expand Down

0 comments on commit 3479316

Please sign in to comment.