Last active
January 4, 2016 09:29
-
-
Save laser/8601951 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# app/controllers/calculation.rb | |
def create | |
req = ActiveSupport::JSON.decode(request.body) | |
calculator = StatefulCalculator.new | |
# to_crunch => [[1, 2, 3], [9, 10, 11]] | |
@sums = req["to_crunch"].map do |nums| | |
NumberCruncher.new(calculator).crunch(nums) | |
end | |
render :calculation_view | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
replace the
req[“to_crunch”]
withreq[“arrays_to_crunch”]
because in the blog it's explained asreq[“arrays_to_crunch”]