Skip to content

Commit

Permalink
forgot an ctrl+s in authors model, should solve #29
Browse files Browse the repository at this point in the history
  • Loading branch information
akuchinke committed Nov 9, 2017
1 parent 8bc1a15 commit 828a4c5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/controllers/authors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def show
end

def new
@author = Author.new
@author = Author.new()
end

def edit
Expand All @@ -20,7 +20,7 @@ def edit

def create
@author = Author.new(author_params)

if @author.save
redirect_to @author
else
Expand Down
2 changes: 1 addition & 1 deletion app/models/author.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Author < ActiveRecord::Base
has_many :papers
has_and_belongs_to_many :papers
validates :last_name, presence: true
def name
first_name+ " "+ last_name
Expand Down
1 change: 0 additions & 1 deletion spec/factories/papers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
title "COMPUTING MACHINERY AND INTELLIGENCE"
venue "Mind 49: 433-460"
year 1950
authors []
end

end
2 changes: 1 addition & 1 deletion spec/models/author_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
end

it "have papers" do
author = Author.new()
author = create :author
expect(author.papers).to be_empty

end
Expand Down

0 comments on commit 828a4c5

Please sign in to comment.