-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Brice TEXIER
committed
Sep 10, 2016
1 parent
859693a
commit 70cb67a
Showing
21 changed files
with
424 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# = Informations | ||
# | ||
# == License | ||
# | ||
# Ekylibre - Simple agricultural ERP | ||
# Copyright (C) 2008-2009 Brice Texier, Thibaud Merigon | ||
# Copyright (C) 2010-2012 Brice Texier | ||
# Copyright (C) 2012-2016 Brice Texier, David Joulin | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see http://www.gnu.org/licenses. | ||
# | ||
# == Table: intervention_labellings | ||
# | ||
# created_at :datetime not null | ||
# creator_id :integer | ||
# id :integer not null, primary key | ||
# intervention_id :integer not null | ||
# label_id :integer not null | ||
# lock_version :integer default(0), not null | ||
# updated_at :datetime not null | ||
# updater_id :integer | ||
# | ||
class InterventionLabelling < Ekylibre::Record::Base | ||
belongs_to :intervention | ||
belongs_to :label | ||
# [VALIDATORS[ Do not edit these lines directly. Use `rake clean:validations`. | ||
validates :intervention, :label, presence: true | ||
# ]VALIDATORS] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# = Informations | ||
# | ||
# == License | ||
# | ||
# Ekylibre - Simple agricultural ERP | ||
# Copyright (C) 2008-2009 Brice Texier, Thibaud Merigon | ||
# Copyright (C) 2010-2012 Brice Texier | ||
# Copyright (C) 2012-2016 Brice Texier, David Joulin | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see http://www.gnu.org/licenses. | ||
# | ||
# == Table: labels | ||
# | ||
# color :string not null | ||
# created_at :datetime not null | ||
# creator_id :integer | ||
# id :integer not null, primary key | ||
# lock_version :integer default(0), not null | ||
# name :string not null | ||
# updated_at :datetime not null | ||
# updater_id :integer | ||
# | ||
|
||
class Label < Ekylibre::Record::Base | ||
has_many :intervention_labellings | ||
has_many :interventions, through: :intervention_labellings | ||
has_many :product_labellings | ||
has_many :products, through: :product_labellings | ||
# [VALIDATORS[ Do not edit these lines directly. Use `rake clean:validations`. | ||
validates :color, presence: true, length: { maximum: 500 } | ||
validates :name, presence: true, uniqueness: true, length: { maximum: 500 } | ||
# ]VALIDATORS] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# = Informations | ||
# | ||
# == License | ||
# | ||
# Ekylibre - Simple agricultural ERP | ||
# Copyright (C) 2008-2009 Brice Texier, Thibaud Merigon | ||
# Copyright (C) 2010-2012 Brice Texier | ||
# Copyright (C) 2012-2016 Brice Texier, David Joulin | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see http://www.gnu.org/licenses. | ||
# | ||
# == Table: product_labellings | ||
# | ||
# created_at :datetime not null | ||
# creator_id :integer | ||
# id :integer not null, primary key | ||
# label_id :integer not null | ||
# lock_version :integer default(0), not null | ||
# product_id :integer not null | ||
# updated_at :datetime not null | ||
# updater_id :integer | ||
# | ||
class ProductLabelling < Ekylibre::Record::Base | ||
belongs_to :product | ||
belongs_to :label | ||
# [VALIDATORS[ Do not edit these lines directly. Use `rake clean:validations`. | ||
validates :label, :product, presence: true | ||
# ]VALIDATORS] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class CreateLabels < ActiveRecord::Migration | ||
def change | ||
create_table :labels do |t| | ||
t.string :name, null: false | ||
t.string :color, null: false | ||
t.stamps | ||
t.index :name, unique: true | ||
end | ||
|
||
create_table :intervention_labellings do |t| | ||
t.references :intervention, null: false, index: true | ||
t.references :label, null: false, index: true | ||
t.stamps | ||
t.index [:intervention_id, :label_id], unique: true | ||
end | ||
|
||
create_table :product_labellings do |t| | ||
t.references :product, null: false, index: true | ||
t.references :label, null: false, index: true | ||
t.stamps | ||
t.index [:product_id, :label_id], unique: true | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.