Generated model Survey with migration
This commit is contained in:
3
app/models/survey.rb
Normal file
3
app/models/survey.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class Survey < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
end
|
||||
11
db/migrate/20140227235852_create_surveys.rb
Normal file
11
db/migrate/20140227235852_create_surveys.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class CreateSurveys < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :surveys do |t|
|
||||
t.string :title
|
||||
t.text :description
|
||||
t.references :user, index: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
11
test/fixtures/surveys.yml
vendored
Normal file
11
test/fixtures/surveys.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
title: MyString
|
||||
description: MyText
|
||||
user_id:
|
||||
|
||||
two:
|
||||
title: MyString
|
||||
description: MyText
|
||||
user_id:
|
||||
7
test/models/survey_test.rb
Normal file
7
test/models/survey_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class SurveyTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
Reference in New Issue
Block a user