-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
receber ID do usuário e responder com um JSON dos seus builds
- Loading branch information
1 parent
df5ec11
commit 899cc0a
Showing
15 changed files
with
95 additions
and
13 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
class Build < ActiveRecord::Base | ||
|
||
# Relations | ||
belongs_to :type, class_name: 'BuildType', foreign_key: 'build_type_id' | ||
belongs_to :user | ||
belongs_to :build_type | ||
This comment has been minimized.
Sorry, something went wrong. |
||
has_and_belongs_to_many :components | ||
|
||
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddUserReferencesToBuilds < ActiveRecord::Migration | ||
def change | ||
add_reference :builds, :user, index: true | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class CreateUsers < ActiveRecord::Migration | ||
def change | ||
create_table :users do |t| | ||
t.string :name | ||
t.string :email | ||
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FactoryGirl.define do | ||
factory :build_type do | ||
name "road" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,12 @@ | |
|
||
FactoryGirl.define do | ||
factory :build do | ||
name "MyString" | ||
|
||
build_type | ||
|
||
trait :with_user do | ||
user | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,15 @@ | |
|
||
FactoryGirl.define do | ||
factory :user do | ||
provider "MyString" | ||
uid "MyString" | ||
|
||
name "MyString" | ||
oauth_token "MyString" | ||
oauth_expires_at "2013-10-07 20:40:28" | ||
email "[email protected]" | ||
|
||
trait :provider do | ||
provider "MyString" | ||
uid "MyString" | ||
oauth_token "MyString" | ||
oauth_expires_at "2013-10-07 20:40:28" | ||
end | ||
end | ||
This comment has been minimized.
Sorry, something went wrong.
digoonrails
Author
Contributor
|
||
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
require 'spec_helper' | ||
|
||
describe User do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
it { have_db_column :name } | ||
it { should have_many(:builds).class_name('Build') } | ||
end |
@rbrancher e @lucas aqui voltei para o padrão do Rails porque estava dando conflito ao instanciar um novo objeto. sei q o
type
era um capo reservado para o tipo do objeto em caso de herança, não sei se mudaram.