Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Issues
  • #1860
Closed
Open
Issue created Jan 07, 2021 by Administrator@rootContributor

Administrate doesn't read context on Model when load form for mandatory field

Created by: helmiItsavirus

  • What were you trying to do?

When I define validation inside of the context on my Model, Administrate doesn't read the context. So, Mandatory appears on the form that should not appear because of the mandatory inside of the context.

  • What did you end up with (logs, or, even better, example apps are great!)?
class User < ApplicationRecord
  with_options on: [:update_birth_date] do
    before_validation :age_is_old_enough
    validates_presence_of :birth_date
  end
end
  • What versions are you running?
  • ruby "2.6.6"
  • gem "rails", "~> 6.0.3", ">= 6.0.3.2"
  • gem "administrate", "~> 0.14.0"
Assignee
Assign to
Time tracking