text
stringlengths
10
2.61M
require 'spec_helper' class ArrayMapObject < Petstore::Category attr_accessor :int_arr, :pet_arr, :int_map, :pet_map, :int_arr_map, :pet_arr_map, :boolean_true_arr, :boolean_false_arr def self.attribute_map { :int_arr => :int_arr, :pet_arr => :pet_arr, :int_map => :int_map, :pet_map =>...
class Video < ActiveRecord::Base validates_presence_of :name, :source mount_uploader :source, VideoUploader end
require 'fog/collection' require 'fog/bluebox/models/template' module Fog module Bluebox class Mock def images(attributes = {}) Fog::Bluebox::Templates.new({ :connection => self }.merge!(attributes)) end end class Real def images(attributes = {}) Fog:...
class AddWorkerAndThreadCountToBatches < ActiveRecord::Migration def change add_column :batches, :worker_count, :integer add_column :batches, :thread_count, :integer end end
class SecurityQuestion < ActiveRecord::Base attr_accessor :locale, :name end
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
require 'bel' require 'json_schema' require 'multi_json' require 'app/resources/annotation' require 'app/resources/completion' require 'app/resources/evidence' require 'app/resources/function' require 'app/resources/match_result' require 'app/resources/namespace' require 'app/schemas' module OpenBEL module Routes ...
class Javascript attr_accessor :controller_name, :user_id def initialize(controller_name = 'Javascript',user_id) @controller_name = controller_name @data_table = DataTables.new('Application Name','Framework Used',ApplicationItem.where(userid:user_id ,category: @controller_name.downcase),@controlle...
# Whenever a multi-line description is printed, for some reason an extra glyph is added at the line break # This Fixes that. class Window_Base alias :process_normal_character_vxa :process_normal_character def process_normal_character(c, pos) return unless c >= ' ' #skip drawing if c is not a displayable character...
class TicketsController < ApplicationController def index if(params.has_key?(:ticket_type_id)) @tickets = Ticket.where(:ticket_type_id => params[:ticket_type_id]) else @tickets = Ticket.all end render json: @tickets end def show @ticket = Ticket.find(params[:id]) r...
require "spec_helper" RSpec.describe "Day 11: Dumbo Octopus" do let(:runner) { Runner.new("2021/11") } let(:input) do <<~TXT 5483143223 2745854711 5264556173 6141336146 6357385478 4167524645 2176841721 6882881134 4846848554 5283751526 TXT end ...
require 'test_helper' class EntryTest < ActiveSupport::TestCase test "is valid with valid attributes" do entry = Entry.new(meal_type: "Breakfast", calories: 450, proteins: 40, carbohydrates: 30, fats: 20) assert entry.save end # not necessary test "should not save entry without meal_types" do entr...
# thats_odd.rb # The code below shows an example of a `for` loop. Modify the code so that it # only outputs `i` if `i` is an odd number. for i in 1..100 puts i if i % 2 != 0 end puts '-----' # ...or... for i in 1..100 puts i if i.odd? end
require 'test_helper' class PageHeadingsControllerTest < ActionDispatch::IntegrationTest setup do @page_heading = page_headings(:one) end test "should get index" do get page_headings_url assert_response :success end test "should get new" do get new_page_heading_url assert_response :succ...
class AddProductCountToOrders < ActiveRecord::Migration[5.0] def change add_column :orders, :product_count, :integer add_reference :orders, :product, index: true end end
module XcodeMove class ProjectCache @@cache = Hash.new def self.open(path) path = Pathname.new(path).realpath @@cache[path] ||= Xcodeproj::Project.open(path) end end end
#!/usr/bin/env ruby module Hive Color = {:white => 0, :black => 1} class Game # These are all the variables we want the Game class to share with other objects: attr_accessor :trays, :bugs, :surface, :turn, :...
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable, omniauth_providers: [:facebook,...
# Databases and other places may truncate usecs, so we define a mathers that # truncates usecs form dates before testing for equality RSpec::Matchers.define(:eq_up_to_sec) do |expected| match do |actual| actual.try(:change, usec: 0) == expected.try(:change, usec: 0) end diffable end
class CreateTimeGliders < ActiveRecord::Migration def self.up create_table :time_gliders do |t| t.integer :tg_id t.string :title t.text :description t.date :focus_date t.integer :initial_zoom t.string :events_url t.text :events t.text :legend t.timestamps ...
class Doctor < ActiveRecord::Base attr_accessible :duration, :name, :specialization_id belongs_to :specialization end
class Api::V1::SkillsController < Api::V1::BaseController def index @skills = Skill.all skip_policy_scope end end
module MainHelper def get_rating_value_for_restaurant(restaurant) rating = Rating.scope_restaurant_id(restaurant.id).scope_user_id(@current_user.id).first #Scope is used to filter the rows in the db based on the variables passed #Retrieves rating value(if any) for the current user and restaurant id that exists in ...
# [Launch School - an online school for Software Engineers](https://launchschool.com/lessons/85376b6d/assignments/a76c28ac) #### Practice Problem 7 # Create a hash that expresses the frequency with which each letter occurs in this string: # `statement = "The Flintstones Rock"` # ex: # `{ "F"=>1, "R"=>1, "T"=>1, "c"...
# Write your sql queries in this file in the appropriate method like the example below: # # def select_category_from_projects # "SELECT category FROM projects;" # end # Make sure each ruby method returns a string containing a valid SQL statement. def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabe...
class GuardiansController < ApplicationController def index @student = Student.find(params[:student_id]) end def create @student = Student.find(params[:student_id]) @guardian = Guardian.create(guardian_params) if @guardian.save respond_to do |format| format.html { redirect_to :back...
#!/usr/bin/env ruby # :title: PlanR::PluginManager =begin rdoc Plan R Plugin Manager (c) Copyright 2016 Thoughtgang <http://www.thoughtgang.org> =end require 'tg/plugin' require 'tg/plugin_mgr' require 'plan-r/application/service' $TG_PLUGIN_DEBUG=true # attempt to load plan-r-plugins gem. begin gem 'plan-r-plugin...
# spec/support/wait_for_ajax.rb def wait_for_ajax Timeout.timeout(5) do loop until finished_all_ajax_requests? end end def finished_all_ajax_requests? page.evaluate_script('jQuery.active').zero? end def wait_for_visible_modal(key = nil) Timeout.timeout(5) do loop until visible_modal?(key) end end d...
# frozen_string_literal: true module Vedeu module Coercers # The subclasses of this class, HorizontalAlignment and # VerticalAlignment provide the mechanism to validate a horizontal # or vertical alignment value. # # @see Vedeu::Coercers::HorizontalAlignment # @see Vedeu::Coercers::Vertical...
class Product < ActiveRecord::Base belongs_to :vendor has_and_belongs_to_many :carts has_and_belongs_to_many :wishlists end
class NotificationsController < ApplicationController before_action :signed_in, :correct_user, only: [:new, :create] def create self.format_message() @notification = Event.find(cookies.signed[:current_event_id]).notifications.build(notification_params) @notification.user_id = current_user.id if @notificatio...
require_relative '../plateau' describe Plateau do before do @grid = Plateau.new(15,15) end context "Setup grid" do it "should setup a 15x15 grid" do expect(@grid.to_s).to eql '(15, 15)' end end end
# frozen_string_literal: true class Play < ApplicationRecord validates :description, length: { maximum: 400 } belongs_to :user has_many :comments, dependent: :destroy has_many :favorites, dependent: :destroy has_many :favorited_users, through: :favorites, source: :user belongs_to :category, optional: true ...
require 'cloudformation_mapper/resource' class CloudformationMapper::Resource::AwsResourceEc2InternetGateway < CloudformationMapper::Resource register_type 'AWS::EC2::InternetGateway' type 'Template' parameter do type 'Template' name :Properties parameter do type 'AWS CloudFormation Resour...
class Session < ApplicationRecord belongs_to :month belongs_to :advisor belongs_to :day_has_hour belongs_to :subject, optional: true has_many :session_has_students has_many :students, through: :session_has_students validates :month, presence: true validates :advisor, presence: true validates :day_ha...
# no helper_method calls # no instance variables # no locals # options are automatically made instance methods via constructor. # call "helpers" in class # TODO: warn when using ::property but not passing in model in constructor. require 'uber/delegates' # ViewModel is only supported in Rails +3.1. If you need it in ...
class OperationAnesthesia < ActiveRecord::Migration def self.up add_column :operations, :anesthesia_type, :string add_column :operations, :peripheral_nerve_block_type, :string end def self.down remove_column :operations, :peripheral_nerve_block_type remove_column :operations, :anesthesia_type e...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
class CreateRestaurantsJob < ApplicationJob queue_as :default def expiration @expiration = 60 * 60 * 24 * 30 # 30 days end def perform(location) start = 0 counter = 0 hash = {} 5.times do url = "https://www.yelp.com/search?find_desc=Restaurants&find_loc=#{location[0]} #{location[1]...
Rails.application.routes.draw do devise_for :users authenticated :user do root :to => 'dashboard#index', as: :authenticated_root end root :to => 'home#index' resources :racecards resources :leagues resources :likes resources :meetings resources :horses do member do get 'like' get...
# # A navigation menu class # class Menu attr_accessor :parent attr_accessor :children attr_accessor :name # # load the menu.txt file and build the in-memory menu array # def load(menu_file_path) File.open(menu_file_path) do |file| parse_menu(file) end end def initialize(name, parent=...
name 'ant' maintainer 'Chef Software, Inc.' maintainer_email 'Akshay.kalra@expicient.com' license 'Apache 2.0' description 'Installs/Configures ant' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.0.1' %w(debian ubuntu centos redhat fedora).ea...
FactoryBot.define do # Define your Spree extensions Factories within this file to enable applications, and other extensions to use and override them. # # Example adding this to your spec_helper will load these Factories for use: # require 'spree_delivery/factories' factory :delivery, class: Spree::Delivery d...
require 'set' class RoutesController < ApplicationController before_action :set_route, only: [:show, :edit, :update, :destroy] before_action :find_origin_and_destination, only: [:find_shortest_route, :djystras_algo_for_shortest_path, :iterative_find_shortest_distance] include RoutesHelper # GET /routes # GET ...
# Open the Refinery::Page model for manipulation Refinery::Page.class_eval do has_and_belongs_to_many :reviews, :class_name => '::Refinery::Testimonials::Testimonial', join_table: "refinery_pages_testimonials" validates :testimonials_count, numericality: { only_integer: true, greater_than_or_equal_to: 0 } d...
module Primes class Printer def self.table_as_string(table) cell_size = (table.last * table.last).to_s.length + 2 output = "#{_first_row(table, cell_size)}\n" table.each_with_index do |_, row| output += _first_column_of_row(table, row, cell_size) table.each_with_index { |_, col| ...
class Message < ApplicationRecord belongs_to :user belongs_to :chatroom validates :content, presence: true def self.get_messages_by_chat(id) Message.all.select{|m|m.chatroom_id == id} end def self.get_latest_messages(id) all_messages = get_messages_by_chat(id) if all_messages.length >= 10 ...
class Api::TodoListItemsController < ApplicationController before_action :find_todo_list def create @todo_list_item = @todo_list.todo_list_items.new(list_params) if @todo_list_item.save render "status": 200, json: { "message": "Successfully created", "todo_list_item": @todo_list_item ...
class FindTheBestLocation < ActiveRecord::Base include Generatable extend FriendlyId friendly_id :county, use: [:slugged, :history, :finders] DEFINITION_NAME = 'FindTheHome'.freeze # Associations belongs_to :definition # Validations validates :ftb_id, :county, :definition, presence: true validates...
class AddCityAndWebsiteURlAndCompanyNameAndContactAddressToJobs < ActiveRecord::Migration[5.1] def change add_column :jobs, :city, :string add_column :jobs, :company_website, :string add_column :jobs, :company_name, :string add_column :jobs, :company_contact_email, :string end end
namespace :quick_jobs do task :process => :environment do Rails.logger = Logger.new(ENV['LOG_FILE'] || STDOUT) if defined?(Moped) Moped.logger = nil end env = ENV['RAILS_ENV'] || 'production' Rails.logger.info "Starting quick_jobs processor for #{env}" begin while Process.ppid !=...
class IndexForeignKeysInBankItems < ActiveRecord::Migration def change add_index :bank_items, :from_account_id add_index :bank_items, :to_account_id end end
author: "RogΓ©rio da Silva Yokomizo <me@ro.ger.io>" category: "auth" summary: "Authentication via JWT token" home: "https://github.com/yokomizor/ejabberd-auth-jwt" url: "git@github.com:yokomizor/ejabberd-auth-jwt.git"
module ApplicationHelper def current_user @current_user ||= User.find_by_session_token(session[:token]) end def login!(user) session[:token] = user.reset_session_token! @current_user = user end def logged_in? !!current_user end def logout current_user.try(:reset_session_token...
class RemoveNullConstraintsOnUsers < ActiveRecord::Migration def self.up change_column :users, :login, :string, :null => true change_column :users, :crypted_password, :string, :null => true change_column :users, :password_salt, :string, :null => true change_column :users, :persistence_token, :strin...
require_relative 'grid' module Sudoku module Board module Builder module_function def multiple_boards(path) file = File.open(path) boards = [] file.each_line { |line| boards << single_board(line) } boards end def single_board(string) rows = string...
require 'rails_helper' describe GeneratePdf, type: :use_case do let(:document) { FactoryGirl.create :document } subject(:use_case) { GeneratePdf.perform(document) } it 'generates PDF data' do # Sophisticated PDF verification expect(use_case.pdf_data).to include '%PDF-1.4' end end
source 'http://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 4.1.4' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use MySQL as the database for Active Record gem 'mysql2', group: :production # Use SCSS for stylesheets gem 'sass-rails', '~> 4.0.3' #...
class DropSongDances < ActiveRecord::Migration def change drop_table :song_dances end end
# frozen_string_literal: true module Utilities def approximately_equal(one, two) return false if one.nil? || two.nil? diff = (one - two).abs max_diff = [[one.abs, two.abs].max * 0.002, 1].max diff <= max_diff end end
require 'spec_helper' describe Graphlient::Adapters::HTTP::FaradayAdapter do let(:app) { Object.new } context 'with a custom middleware' do let(:client) do Graphlient::Client.new('http://example.com/graphql') do |client| client.http do |h| h.connection do |c| c.use Faraday:...
# frozen_string_literal: true class Webhook < ApplicationRecord include Spell belongs_to :user belongs_to :character validates :name, presence: true validates :uid, presence: true validates :channel, presence: true validates :character, presence: true validates :user, presence: true validates :url,...
$:.push File.expand_path('../lib', __FILE__) require 'ggs/version' Gem::Specification.new do |s| s.name = 'ggs-rails' s.version = GGS::VERSION s.platform = Gem::Platform::RUBY s.authors = ['Ryan Ahearn'] s.email = ['ryan@coshx.com'] s.homepage = 'https://github.com/rahearn/ggs-ra...
module Cucumber module Core module Test class TagFilter include Cucumber.initializer(:filter_expressions, :receiver) def test_case(test_case) if test_case.match_tags?(filter_expressions) test_case.describe_to(receiver) end self end en...
# encoding: utf-8 #! /usr/bin/env ruby ## # Auteur CrakeTeam # Version 0.1 : Date : Mon Mar 17 09:42 2013 # require 'gtk2' require_relative 'Events' require_relative 'EventsJeu' require './Vue/Fenetres/FenetreChoixSauvegarde' class EventsChoixSauvegarde < Events public_class_method :new def initialize(jeu...
require 'rails_helper' RSpec.describe User, type: :model do it "nameが空γͺらバγƒͺγƒ‡γƒΌγ‚·γƒ§γƒ³γŒι€šγ‚‰γͺい" do user = User.new(name: '', email: 'test@gmail.com', password: '111111') expect(user).not_to be_valid end it "nameが30ζ–‡ε­—δ»₯上γͺらバγƒͺγƒ‡γƒΌγ‚·γƒ§γƒ³γŒι€šγ‚‰γͺい" do user = User.new(name: 'a'*31, email: 'test@gmail.com', password: '111111'...
# View helpers: # # active('my_url') # Accepts a string or an array of strings. # Returns 'active' if the path arguments matches the current request path. # Useful for sticky/active links. # # <%= alert %> # Easy way to display flash[:alert] messages # In the route handler: # flash[:alert] = 'Welcome back!' # And in ...
require 'rubygems' Gem::Specification.new do |spec| spec.name = 'rkerberos' spec.version = '0.1.0' spec.author = 'Daniel Berger' spec.license = 'Artistic 2.0' spec.email = 'djberg96@gmail.com' spec.homepage = 'http://github.com/djberg96/rkerberos' spec.platform = Gem::Platform::R...
class PositionsController < ApplicationController before_action :set_position, only: [:edit, :update, :destroy] before_action :authenticate_user! def index @positions = Position.all end def new @position = Position.new end def create # render plain: params[:position].inspect @position =...
module Biceps class ApiVersion attr_accessor :version, :accept def initialize(version) @version = [version].flatten end def matches?(request) @accept = request.accept valid_api_version? end private def valid_api_version? version.include?(request_version) end...
#!/usr/bin/env ruby require 'set' lastn = 0 seen = Set::new ok = true STDIN.read.split("\n").each do |line| n = line.split(' ')[0].to_i if n != 0 if seen.include? n puts "Line #{n} is duplicated" ok = false elsif n <= lastn puts "Line #{n} is out of order" ok = false end lastn = n seen.add n...
require_relative '../sections' require_relative '../messaging' module ET3 module Test class BasePage < ::SitePrism::Page def self.set_url(url) super "#{ENV['ET3_URL']}#{url}" end section :sidebar, :sidebar_titled, 'components.sidebar.header' do element :claim_link, :link_named, ...
class AddQurabicAudioRelatedChanges < ActiveRecord::Migration[6.1] def change add_column :recitation_styles, :arabic, :string add_column :recitation_styles, :slug, :string add_index :recitation_styles, :slug add_column :verses, :pause_words_count, :integer, default: 0 add_column :resource_contents...
class ResponsesController < ApplicationController before_action :authenticate_user_using_x_auth_token, only: :create def create response = Response.new(load_params.merge(user_id: @current_user.id)) prev_response = Response.find_by(user: @current_user.id, poll: response.poll_id) if(prev_response) ...
class EnterpriseMessagesController < ApplicationController before_action :authenticate_user! before_action :set_enterprise_message, only: [:show, :edit, :update, :destroy] # GET /enterprise_messages def index @enterprise_messages = EnterpriseMessage.all end # GET /enterprise_messages/1 def show en...
class PrestacionResponseBuilder def self.create_from(prestacion) { 'prestacion': { 'id': prestacion.id, 'nombre': prestacion.nombre, 'costo': prestacion.costo } }.to_json end def self.create_from_all(prestaciones) output = { 'prestaciones': [] } pr...
class CreateChitietbosuutaps < ActiveRecord::Migration[5.0] def change create_table :chitietbosuutaps do |t| t.references :bosuutap, foreign_key:true t.references :monan, foreign_key:true t.timestamps end end end
require 'rails_helper' RSpec.describe "Queries API", :type => :request do let!(:user) { Fabricate(:user) } let!(:auth_headers) do { 'From' => user.email, 'X-Grants' => Base64.encode64({ grants: [{}] }.to_json) } end describe "POST /v1/queries" do it "creates queries from JSON POST body" do ...
class DetailedGuide < Edition include Edition::Images include Edition::NationalApplicability include Edition::Topics include ::Attachable include Edition::AlternativeFormatProvider include Edition::FactCheckable include Edition::HasMainstreamCategories include Edition::HasDocumentCollections include E...
require "test_helper" class DanhMucSachesControllerTest < ActionDispatch::IntegrationTest setup do @danh_muc_sach = danh_muc_saches(:one) end test "should get index" do get danh_muc_saches_url assert_response :success end test "should get new" do get new_danh_muc_sach_url assert_respons...
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 require 'spec_helper' describe TwitterCldr::Shared::CodePoint do def clear described_class.instance_variable_set(:@canonical_compositions, nil) described_class.instance_variable_set(:@block_cache, nil) describe...
module UsersHelper # Returns the Gravatar for the given user def gravatar_for(user, options = {size: 50, image_icon: 'monsterid'}) gravatar_id = Digest::MD5::hexdigest(user.email.downcase) gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{options[:size]}&d=#{options[:image_icon]}" i...
class Like < ApplicationRecord belongs_to :cat belongs_to :user validates :cat_id, uniqueness: {scope: :user_id} end
require 'rails_helper' RSpec.describe Search::MessagesFilter, type: :service do describe 'filtering' do context ':recipient and :sender' do let!(:message1) { Message.create(recipient: 'corey', sender: 'abbey', body: Faker::Lorem.sentence) } let!(:message2) { Message.create(recipient: 'corey', sende...
class CompletionsController < ApplicationController def create todo.complete! #touch sets a timestamp to the current time then persists the record. Plenty to refactor, but feature works, and the suite is green, so we're committing redirect_to todos_path end def destroy todo.mark_incomplete! redir...
class FontFantasqueSansMonoNerdFont < Formula version "2.3.3" sha256 "594d9e770d5072660e62c421da66a0c806aa4f0f1a28b8935d4939d84e9e5dd4" url "https://github.com/ryanoasis/nerd-fonts/releases/download/v#{version}/FantasqueSansMono.zip" desc "FantasqueSansMono Nerd Font (Fantasque Sans Mono)" desc "Developer tar...
require_relative 'log_repository' require_relative 'log_factory_log_formatter' module RTALogger # show log items on console out put class LogRepositoryConsole < LogRepository def initialize super end def load_config(config_json) super end # register :console protected de...
require 'spec_helper' describe UsersController do describe '#create' do let(:format) { :json } let(:params) { { format: format } } subject { post :create, params } its(:status) { is_expected.to eq(201) } end end
class CreateSpells < ActiveRecord::Migration def change create_table :spells do |t| t.references :character_race, index: true t.string :name t.string :spelllevel t.string :spellschool t.string :castingtime t.string :range t.string :components t.string :duration ...
# frozen_string_literal: true require Rails.root.join("lib", "pulfalight", "missing_repository_error") # Asynchronous job used to index EAD Documents class AspaceIndexJob < ApplicationJob # Class for capturing the output of the Traject indexer class EADArray < Array # Appends the output of the Traject indexer ...
require 'spec_helper' describe 'roads/index' do before do assign(:roads, [Road.make!(:road1), Road.make!(:road1)]) render end it "should show partials _road_small_card for all the roads" do expect(view).to render_template(:partial => "_road_small_card", :count => 2) end it "should show the map,...
require 'spec_helper' module Headjack describe DefaultAdapter do let(:dummy) { Object.new.object_id } describe "::all_filter" do it { expect(DefaultAdapter.all_filter(dummy)).to be dummy } end describe "::auto_filter" do it { expect(DefaultAdapter.all_filter(dummy)).to be dummy } en...
class Order < ApplicationRecord belongs_to :user belongs_to :restaurant has_many :order_meals has_many :order_histories has_many :meals , through: :order_meals validates :user, :restaurant, :presence => true end
require 'rails_helper' RSpec.describe Item, type: :model do before do @item = FactoryBot.build(:item) end describe 'ε•†ε“ζŠ•η¨Ώζ©Ÿθƒ½' do context 'ε•†ε“ζŠ•η¨ΏγŒγ†γΎγθ‘Œγζ™‚' do it 'name, introduction, category_id, item_condition_id, postage_payer_id, prefecture_id, preparation_day_id, price, imageγŒε­˜εœ¨γ™γ‚Œγ°η™»ιŒ²γ§γγ‚‹' do e...
class Brochure < ActiveRecord::Base has_many :pdfs end
class DashboardController < ApiController before_action :require_login def index if(params[:getStudentsLate] == "true") students = Dashboard.getStudentsLate(params[:keyword], params[:page], params[:studentsPerPage], params[:present]) res = { "students": students, "total": Dashboard...
class Doctor attr_accessor :name @@all = [] def initialize(name) @name = name @@all << self end def self.all @@all end def appointments Appointment.all.select{|appointment| appointment.doctor == self } end def new_appointment(patient,date) Appointment.new(date,patient,self) ...
module DeviseApiAuth module Config extend self attr_reader :options def configure yield self.options end def options @options ||= { header_iv: 'x-app-iv', header_credentials: 'x-app-credentials', param_iv: '_iv', param_credentials: '_credentials', model_id_attribute: 'id' } end...
# frozen_string_literal: true def check_if_user_gave_input abort('mkdir: missing input') if ARGV.empty? end def create_folder(name) Dir.mkdir(name) end def create_lib_folder(folder_name) Dir.mkdir("#{folder_name}/lib") end def create_gem_file(folder_name) file = File.open("#{folder_name}/Gemfile", 'a') fi...
class User < ActiveRecord::Base has_one :client has_one :master accepts_nested_attributes_for :client attr_accessible :name, :email, :role, :password, :password_confirmation, :remember_me, :profile_attributes attr_readonly :role validates_presence_of :role acts_as_voter # :token_authenticatabl...