Skip to content

Commit 69d9a99

Browse files
author
Acep Saepudin
committed
membuat model,migration tabel article dari generator rails (rails g model..)
1 parent 2b3d6eb commit 69d9a99

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

app/models/article.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class Article < ActiveRecord::Base
2+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class CreateArticles < ActiveRecord::Migration
2+
def change
3+
create_table :articles do |t|
4+
t.string :title
5+
t.text :content
6+
t.string :name
7+
8+
t.timestamps null: false
9+
end
10+
end
11+
end

test/fixtures/articles.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2+
3+
one:
4+
title: MyString
5+
content: MyText
6+
name: MyString
7+
8+
two:
9+
title: MyString
10+
content: MyText
11+
name: MyString

test/models/article_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require 'test_helper'
2+
3+
class ArticleTest < ActiveSupport::TestCase
4+
# test "the truth" do
5+
# assert true
6+
# end
7+
end

0 commit comments

Comments
 (0)