On Github hqmq / presentation-rails-layers
Michael Ries
Twitter @hqmq_
Github @hqmq
class CreateCourseRecords < ActiveRecord::Migration
...
end
So what would it take to make it work within our application? A Migration...
class CourseRecord < ActiveRecord::Base
...
end
A model
module UpdateCourseRecordsOnCreate
extend ActiveSupport::Concern
included do
after_save :recalculate_records
end
end
Some sort of observer to recalculate records when new games are created.
require 'sinatra'
post '/game.json' do
...calculate records...
end
get '/:course_id/records.json' do
end
So what would it take to make it work as a new service? A Sinatra app...