mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +02:00
parent
36487a0c51
commit
a65354c301
4 changed files with 15 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
class Message < ActiveRecord::Base
|
class Message < ActiveRecord::Base
|
||||||
include Versions # version/message_version.rb
|
include Versions # version/message_version.rb
|
||||||
belongs_to :registrar
|
belongs_to :registrar, required: true
|
||||||
|
|
||||||
before_create -> { self.queued = true }
|
before_create -> { self.queued = true }
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class ChangeMessagesRegistrarIdToNotNull < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
change_column_null :messages, :registrar_id, false
|
||||||
|
end
|
||||||
|
end
|
|
@ -2184,7 +2184,7 @@ ALTER SEQUENCE mail_templates_id_seq OWNED BY mail_templates.id;
|
||||||
|
|
||||||
CREATE TABLE messages (
|
CREATE TABLE messages (
|
||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
registrar_id integer,
|
registrar_id integer NOT NULL,
|
||||||
body character varying,
|
body character varying,
|
||||||
attached_obj_type character varying,
|
attached_obj_type character varying,
|
||||||
attached_obj_id character varying,
|
attached_obj_id character varying,
|
||||||
|
@ -5070,3 +5070,5 @@ INSERT INTO schema_migrations (version) VALUES ('20180126104536');
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20180126104903');
|
INSERT INTO schema_migrations (version) VALUES ('20180126104903');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20180211011450');
|
||||||
|
|
||||||
|
|
|
@ -14,4 +14,10 @@ class MessageTest < ActiveSupport::TestCase
|
||||||
@message.validate
|
@message.validate
|
||||||
assert @message.invalid?
|
assert @message.invalid?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_invalid_without_registrar
|
||||||
|
@message.registrar = nil
|
||||||
|
@message.validate
|
||||||
|
assert @message.invalid?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue