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
# frozen_string_literal: true | |
module Api | |
module V1 | |
# Controller to consume read-only data to be used on client's frontend | |
class FrontEndController < ActionController::API | |
include Orderable | |
# GET /:resource | |
# GET /:resource.json |
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
module FactoryGirl::Syntax::Methods | |
def find_or_create(name, attributes = {}, &block) | |
factory = FactoryGirl.factory_by_name(name) | |
clazz = factory.build_class | |
factory_attributes = FactoryGirl.attributes_for(name) | |
attributes = factory_attributes.merge(attributes) | |
clazz.find_or_create_by(attributes, &block) | |
end |
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
class MegaLotto | |
NUMBERS = 5 | |
def draw | |
Array.new(NUMBERS){ single_draw } | |
end | |
private | |
def single_draw |