fixes #2100
This commit is contained in:
@@ -37,7 +37,7 @@ class DmailsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@dmail = Dmail.create_split(params[:dmail])
|
@dmail = Dmail.create_split(params[:dmail].merge(:creator_ip_addr => request.remote_ip))
|
||||||
respond_with(@dmail)
|
respond_with(@dmail)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Dmail < ActiveRecord::Base
|
|||||||
belongs_to :from, :class_name => "User"
|
belongs_to :from, :class_name => "User"
|
||||||
after_create :update_recipient
|
after_create :update_recipient
|
||||||
after_create :send_dmail
|
after_create :send_dmail
|
||||||
attr_accessible :title, :body, :is_deleted, :to_id, :to, :to_name
|
attr_accessible :title, :body, :is_deleted, :to_id, :to, :to_name, :creator_ip_addr
|
||||||
|
|
||||||
module AddressMethods
|
module AddressMethods
|
||||||
def to_name
|
def to_name
|
||||||
|
|||||||
5
db/migrate/20140221213349_add_ip_addr_to_dmails.rb
Normal file
5
db/migrate/20140221213349_add_ip_addr_to_dmails.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class AddIpAddrToDmails < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :dmails, :creator_ip_addr, :inet, :null => false, :default => "127.0.0.1"
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -849,7 +849,8 @@ CREATE TABLE dmails (
|
|||||||
is_read boolean DEFAULT false NOT NULL,
|
is_read boolean DEFAULT false NOT NULL,
|
||||||
is_deleted boolean DEFAULT false NOT NULL,
|
is_deleted boolean DEFAULT false NOT NULL,
|
||||||
created_at timestamp without time zone NOT NULL,
|
created_at timestamp without time zone NOT NULL,
|
||||||
updated_at timestamp without time zone NOT NULL
|
updated_at timestamp without time zone NOT NULL,
|
||||||
|
creator_ip_addr inet DEFAULT '127.0.0.1'::inet NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -6636,4 +6637,6 @@ INSERT INTO schema_migrations (version) VALUES ('20131228230219');
|
|||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20140111191413');
|
INSERT INTO schema_migrations (version) VALUES ('20140111191413');
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20140204233337');
|
INSERT INTO schema_migrations (version) VALUES ('20140204233337');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20140221213349');
|
||||||
Reference in New Issue
Block a user