dmails: don't default IP addr to 127.0.0.1 in database (fixes #2908).
Bug introduced in 1400f64; that commit changed dmails so that
creator_ip_addr defaulted to CurrentUser.ip_addr like this:
after_initialize :initialize_attributes, if: :new_record?
def initialize_attributes
self.from_id ||= CurrentUser.id
self.creator_ip_addr ||= CurrentUser.ip_addr
end
...but creator_ip_addr already defaulted to 127.0.0.1 from the database,
so the ||= assignment didn't work. Remove the database default so we
always default to CurrentUser.ip_addr.
This commit is contained in:
@@ -1007,7 +1007,7 @@ CREATE TABLE dmails (
|
||||
is_deleted boolean DEFAULT false NOT NULL,
|
||||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
creator_ip_addr inet DEFAULT '127.0.0.1'::inet NOT NULL
|
||||
creator_ip_addr inet NOT NULL
|
||||
);
|
||||
|
||||
|
||||
@@ -7466,3 +7466,5 @@ INSERT INTO schema_migrations (version) VALUES ('20170117233040');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20170218104710');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20170302014435');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user