Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
2c1700ce
Commit
2c1700ce
authored
9 years ago
by
Mauricio Giacomini Girardello
Browse files
Options
Downloads
Plain Diff
Merge branch 'feature-edit-lo' of gitlab.c3sl.ufpr.br:portalmec/portalmec into feature-edit-lo
parents
e641bf9b
66c80712
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/models/language.rb
+2
-1
2 additions, 1 deletion
app/models/language.rb
lib/tasks/language.rake
+8
-0
8 additions, 0 deletions
lib/tasks/language.rake
test/models/language_test.rb
+10
-0
10 additions, 0 deletions
test/models/language_test.rb
with
20 additions
and
1 deletion
app/models/language.rb
+
2
−
1
View file @
2c1700ce
class
Language
<
ActiveRecord
::
Base
has_many
:learning_object
has_many
:learning_object
s
validates_uniqueness_of
:code
validates_presence_of
:name
,
:code
end
This diff is collapsed.
Click to expand it.
lib/tasks/language.rake
0 → 100644
+
8
−
0
View file @
2c1700ce
namespace
:language
do
desc
'Clean languages that fail the validations'
task
:clean
=>
:environment
do
Language
.
all
.
each
do
|
language
|
Language
.
destroy
language
.
id
if
language
.
invalid?
end
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/models/language_test.rb
0 → 100644
+
10
−
0
View file @
2c1700ce
require
'test_helper'
class
LanguageTest
<
ActiveSupport
::
TestCase
should
have_many
:learning_objects
should
validate_presence_of
(
:name
)
should
validate_presence_of
(
:code
)
should
validate_uniqueness_of
(
:code
)
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment