Skip to content

Commit

Permalink
[api] validate that titles do not exceed what mysql allows
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Feb 13, 2014
1 parent 7614ae2 commit 5ca229e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/api/app/models/package.rb
Expand Up @@ -73,6 +73,7 @@ class ReadSourceAccessError < APIException
scope :dirty_backend_package, -> { joins('left outer join backend_packages on backend_packages.package_id = packages.id').where('backend_packages.package_id is null') }

validates :name, presence: true, length: { maximum: 200 }
validates :title, length: { maximum: 250 }
validate :valid_name

has_one :backend_package, foreign_key: :package_id, dependent: :destroy, inverse_of: :package
Expand Down
1 change: 1 addition & 0 deletions src/api/app/models/project.rb
Expand Up @@ -72,6 +72,7 @@ class ForbiddenError < APIException
default_scope { where('projects.id not in (?)', Relationship.forbidden_project_ids ) }

validates :name, presence: true, length: { maximum: 200 }
validates :title, length: { maximum: 250 }
validates :type_id, presence: true
validate :valid_name

Expand Down

0 comments on commit 5ca229e

Please sign in to comment.