-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chitter-challenge #210
base: main
Are you sure you want to change the base?
Chitter-challenge #210
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code formatted nicely and is readable and succinct, everything looks like it would work, Just a few newlines to be added.
@@ -84,6 +84,7 @@ GEM | |||
|
|||
PLATFORMS | |||
x86_64-darwin-20 | |||
x86_64-darwin-21 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 87 interesting, what does this do?
result = connection.exec("INSERT INTO peeps (message) VALUES('#{message}') RETURNING id, message") | ||
Peep.new(id: result[0]['id'], message: result[0]['message']) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline
connection = PG.connect(dbname: 'chitter_test') | ||
result = connection.query("SELECT * FROM peeps WHERE id = #{id};") | ||
result.first | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline
|
||
expect(page).to have_content 'This is another peep' | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline
|
||
expect(page).to have_content 'This is a peep!' | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline
connection = PG.connect(dbname: 'chitter') | ||
end | ||
|
||
result = connection.exec("INSERT INTO peeps (message) VALUES('#{message}') RETURNING id, message") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 32 could be open to SQL injection attack.
<%= peep.message %> | ||
</li> | ||
<% end %> | ||
</ul> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline
<form action="/peeps" method="post"> | ||
<input type="text" name="message" /> | ||
<input type="submit" name="Submit" /> | ||
</form> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, it's Simo, a coach. I've reviewed your code and left a few comments below. If you have any questions, please ask!
get '/test' do | ||
'Test page' | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's always a good idea to remove test code from code you submit for code review (anywhere, not just at Makers)
erb :"peeps/index" | ||
end | ||
|
||
get '/peeps/new' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use of RESTful route names!
if ENV['ENVIRONMENT'] == 'test' | ||
connection = PG.connect(dbname: 'chitter_test') | ||
else | ||
connection = PG.connect(dbname: 'chitter') | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This piece of code appears twice in this file. How might you remove this duplication?
expect(peeps.length).to eq 2 | ||
expect(peeps.first).to be_a Peep | ||
expect(peeps.first.id).to eq peep.id | ||
expect(peeps.first.message).to eq 'This is a peep!' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally you'd check that both results in the array are correct
Your name
Shannon White
User stories
Please list which user stories you've implemented (delete the ones that don't apply).
README checklist
Does your README contains instructions for
Here is a pill that can help you write a great README!