Rename 'mail' model to 'email' in order to prevent 'Mail is not a module' error (which only shows in production).
This commit is contained in:
parent
0b963f7105
commit
2fb31549a8
7 changed files with 30 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
|||
class Contact < ActiveRecord::Base
|
||||
has_many :mails
|
||||
has_many :emails
|
||||
has_many :phones
|
||||
end
|
||||
|
|
|
|||
3
app/models/email.rb
Normal file
3
app/models/email.rb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
class Email < ActiveRecord::Base
|
||||
belongs_to :contact
|
||||
end
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
class Mail < ActiveRecord::Base
|
||||
belongs_to :contact
|
||||
end
|
||||
23
db/migrate/20110515190518_create_emails.rb
Normal file
23
db/migrate/20110515190518_create_emails.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
class CreateEmails < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :emails do |t|
|
||||
t.string :desc
|
||||
t.string :address
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
# we drop the 'mails' table as this is basically a renaming (without a need to migrate anything, yet)
|
||||
drop_table :mails
|
||||
end
|
||||
|
||||
def self.down
|
||||
create_table :mails do |t|
|
||||
t.string :desc
|
||||
t.string :address
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
drop_table :emails
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20110514213956) do
|
||||
ActiveRecord::Schema.define(:version => 20110515190518) do
|
||||
|
||||
create_table "contacts", :force => true do |t|
|
||||
t.string "firstname"
|
||||
|
|
@ -24,7 +24,7 @@ ActiveRecord::Schema.define(:version => 20110514213956) do
|
|||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "mails", :force => true do |t|
|
||||
create_table "emails", :force => true do |t|
|
||||
t.string "desc"
|
||||
t.string "address"
|
||||
t.datetime "created_at"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class MailTest < ActiveSupport::TestCase
|
||||
class EmailTest < ActiveSupport::TestCase
|
||||
# Replace this with your real tests.
|
||||
test "the truth" do
|
||||
assert true
|
||||
Loading…
Add table
Add a link
Reference in a new issue