Created
August 31, 2015 17:00
-
-
Save welingtonsampaio/860ca5e1f009ba9c4c65 to your computer and use it in GitHub Desktop.
RABL filter, like Facebook Graph API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateComments < ActiveRecord::Migration | |
def change | |
create_table :comments do |t| | |
t.string :title | |
t.text :content | |
t.bollean :active, default: false | |
t.belongs_to :user | |
t.timestamps null: false | |
end | |
add_index :comments, :user_id | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateUsers < ActiveRecord::Migration | |
def change | |
create_table :users do |t| | |
t.string :name | |
t.date :birthdate | |
t.bollean :active, default: false | |
t.timestamps null: false | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": 1, | |
"name": "Welington Sampaio", | |
"birthdate": 01-01-1980, | |
"active": true, | |
"created_at": 01-08-2015, | |
"updated_at": 01-08-2015, | |
"comments": [ | |
{ | |
"id": 1, | |
"title": "Title 1", | |
"content": "Lorem ipsum ....", | |
"created_at": 01-08-2015, | |
"updated_at": 01-08-2015 | |
} | |
# 500+ entries | |
] | |
}, | |
{ | |
"id": 2, | |
"name": "Elison Campos", | |
"birthdate": 01-01-1985, | |
"active": true, | |
"created_at": 10-08-2015, | |
"updated_at": 10-08-2015, | |
"comments": [ | |
{ | |
"id": 1502, | |
"title": "Elison Title 1", | |
"content": "Lorem ipsum ....", | |
"created_at": 10-08-2015, | |
"updated_at": 10-08-2015 | |
} | |
# 30+ entries | |
] | |
} | |
# n+ entries | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": 1, | |
"name": "Welington Sampaio", | |
"birthdate": 01-01-1980, | |
"comments": [ | |
{ | |
"id": 1, | |
"title": "Title 1", | |
"created_at": 01-08-2015 | |
} | |
# + 9 entries | |
] | |
}, | |
{ | |
"id": 2, | |
"name": "Elison Campos", | |
"birthdate": 01-01-1985, | |
"comments": [ | |
{ | |
"id": 1502, | |
"title": "Elison Title 1", | |
"created_at": 10-08-2015 | |
} | |
# + 9 entries | |
] | |
} | |
# n+ entries | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment