This commit is contained in:
r888888888
2014-02-21 13:46:45 -08:00
parent 2561ccd00b
commit 10516c9834
4 changed files with 12 additions and 4 deletions

View File

@@ -37,7 +37,7 @@ class DmailsController < ApplicationController
end
def create
@dmail = Dmail.create_split(params[:dmail])
@dmail = Dmail.create_split(params[:dmail].merge(:creator_ip_addr => request.remote_ip))
respond_with(@dmail)
end

View File

@@ -10,7 +10,7 @@ class Dmail < ActiveRecord::Base
belongs_to :from, :class_name => "User"
after_create :update_recipient
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
def to_name

View 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

View File

@@ -849,7 +849,8 @@ CREATE TABLE dmails (
is_read boolean DEFAULT false NOT NULL,
is_deleted boolean DEFAULT false 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 ('20140204233337');
INSERT INTO schema_migrations (version) VALUES ('20140204233337');
INSERT INTO schema_migrations (version) VALUES ('20140221213349');