Skip to content

Commit

Permalink
Sanitized form input to protect against SQL injection.
Browse files Browse the repository at this point in the history
  • Loading branch information
corincerami committed Dec 7, 2014
1 parent d360b57 commit d64fddd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
/log/*.log
/tmp
.env
images.rb
5 changes: 2 additions & 3 deletions app/controllers/image_controller.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
class ImageController < ApplicationController
def show
@images = Image.where(sol: params[:sol])
@images = Image.where(:sol => params[:sol])
end

def index
# find the martial solar date of the most recent image taken
# @most_recent = Image.all.sort_by { |hash| -hash[:sol].to_i }.first[:sol]
# find the martian solar date of the most recent image taken
@image_count = Image.count
@most_recent = Image.maximum(:sol)
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/image/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class='row'>
<div class='small 6'>
<p>
These photos were captured by Curiosity on sol <%= params[:sol] %> of its mission on Mars. They come from its eight cameras: the front hazard avoidance camera (FHAZ), read hazard avoidance camera (RHAZ), left and right navigation cameras (NAVCAM), chemistry camera (CHEMCAM), Mars descent imager (MARDI), Mars hand lens imager (MAHLI), and mast camera (Mastcam).
These photos were captured by Curiosity on sol <%=h params[:sol] %> of its mission on Mars. They come from its eight cameras: the front hazard avoidance camera (FHAZ), read hazard avoidance camera (RHAZ), left and right navigation cameras (NAVCAM), chemistry camera (CHEMCAM), Mars descent imager (MARDI), Mars hand lens imager (MAHLI), and mast camera (Mastcam).
</p>
</div>
</div>
Expand Down

0 comments on commit d64fddd

Please sign in to comment.