text
stringlengths
10
2.61M
json.array!(@caves) do |cafe| json.extract! cafe, :id, :name, :description, :lat, :lon json.url cafe_url(cafe, format: :json) end
# -*- coding: binary -*- require 'rex/peparsey/exceptions' require 'rex/peparsey/pebase' require 'rex/struct2' module Rex module PeParsey class Section attr_accessor :_section_header, :_isource attr_accessor :base_rva # # Initialize a section. # # isource - The ImageSource class backing the image...
class ChangeAudioOnSermonsTable < ActiveRecord::Migration[5.0] def change change_table :sermons do |t| t.remove :audiofile t.string :s3file end end end
require 'rails_helper' RSpec.describe Station, :type => :model do let(:station) { Station.new({ "access_days_time"=>"24 hours daily", "fuel_type_code"=>"ELEC", "station_name"=>"UDR", "city"=>"Denver", "state"=>"CO", "street_address"=>"800 Acoma St", "zip"=...
require "test_helper" describe VideosController do VIDEO_FIELDS = ["id", "title", "overview", "release_date", "total_inventory", "available_inventory"].sort it "must get index" do get videos_path must_respond_with :success expect(response.header["Content-Type"]).must_include "json" end it "respon...
module ApplicationHelper def sortable(column, title = nil) title ||= column.titleize case sort_direction when "asc" sort_class = "glyphicon glyphicon-arrow-up" when "desc" sort_class = "glyphicon glyphicon-arrow-down" end css_class = column == sort_column ? "current #{...
# frozen_string_literal: true RSpec.describe DestroyUploadOperation do let!(:record) { create(:user) } describe '#call' do subject { described_class.new(record).call } it 'record is softly deleted' do expect { subject }.not_to change(User, :count).from(1) expect(record.deleted_at).not_to eq n...
class AddCounterForPostUserFavorite < ActiveRecord::Migration[5.2] def change add_column :posts, :favorites_count, :integer, default: 0 add_column :users, :favorite_posts_count, :integer, default: 0 add_column :posts, :likes_count, :integer, default: 0 add_column :users, :like_posts_count, :integer, ...
require 'spec_helper' describe Puppet::Type.type(:nexus_scheduled_task) do let(:defaults) { {:name => 'any', :type => 'any', :reoccurrence => :manual} } let(:once) do defaults.merge({ :reoccurrence => :once, :start_date => '2014-06-01', :start_time => '10:00' }) end let(:weekly)...
class ResourceTypeValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) invalid_resources = get_invalid_resources(value) record.errors.add(attribute, error_message(invalid_resources)) if invalid_resources.any? end private def get_invalid_resources(value) authority ...
require_relative '../spec_helper' feature 'Gadget, as a user, on gadet page, I can' do background do Capybara.current_driver = :selenium @user = create :user @gadgets = [] 3.times { @gadgets << create(:gadget, user: @user) } sign_in_user @user click_link 'Gadgets' end scenario 'see a li...
class ApplicationController < ActionController::API include ActionController::HttpAuthentication::Token::ControllerMethods include ActionController::Serialization rescue_from ActiveRecord::RecordNotFound, with: :record_not_found before_action :authenticate # run authenticate before you run any action pri...
class Project < ActiveRecord::Base belongs_to :home validates :title, presence: true validates :body, presence: true validates :home_id, presence: true end
class EnvironmentDatatable delegate :current_user, :content_tag, :check_box_tag, :params, :link_to, to: :@view delegate :url_helpers, to: 'Rails.application.routes' delegate :session, to: :@view include ApplicationHelper def initialize(view) @view = view end def as_json(options = {}) { ...
# def talk # puts "olá como você está?" # end # talk ############################### def talk(first_name, last_name) puts "Olá #{first_name} #{last_name}, como você está?" end first_name = 'Leonardo' last_name ='Scorza' talk(first_name, last_name)
module Asciidoctor module ITU class Converter < Standoc::Converter def sections_cleanup(x) super insert_missing_sections(x) unless @no_insert_missing_sections insert_empty_clauses(x) resolution_inline_header(x) end def resolution_inline_header(x) return u...
class Winner < ActiveRecord::Base belongs_to :user belongs_to :winning_part belongs_to :room end
class AgedBrie < GenericItem def adjust_quality quality_increment = item.sell_in < 1 ? 2 : 1 item.quality = [MAXIMUM_QUALITY, item.quality + quality_increment].min end end
class Round < ActiveRecord::Base has_many :guesses belongs_to :user belongs_to :deck before_create :set_deck_order before_create :set_num_cards def get_card_ids array = [] self.deck.cards.each do |card| array << card.id end array end def set_num_cards self.num_cards = get_...
# class City # attr_accessor :name, :temperature, :description # $cities = [] # def initialize(city_params) # @name = city_params[:name] # @temperature = city_params[:temperature] # @description = city_params[:description] # end # def save # $cities << self # end # def self.all # $cities # end # e...
# == Schema Information # # Table name: recipients # # id :integer not null, primary key # first_name :string # last_name :string # created_at :datetime not null # updated_at :datetime not null # age :integer # gender ...
require "test/unit" require "equal_rights_for_hash" class TestToH < Test::Unit::TestCase def test_converts_nil_into_hash assert_equal({}, nil.to_h) end def test_converts_real_hash_into_self real_hash = {:real => true} assert_same(real_hash, real_hash.to_h) end def test_converts_fake_hash_into_...
require "spec_helper" require "rspec_api_documentation/dsl" resource "The Permissions System" do let(:user) do project.user end let(:project) do create(:project,:published, public: true) end let(:parsed_response) { parsed = JSON.parse(response_body) parsed.is_a?(Array) ? parsed.map(&:with_i...
class FontLeagueSpartan < Formula version "2.220" sha256 "141a96e215554871504dca16be159901bbb0d56f3a84224f39fe472c7ab4ef47" url "https://github.com/theleagueof/league-spartan/releases/download/#{version}/LeagueSpartan-#{version}.tar.xz", verified: "github.com/theleagueof/league-spartan/" desc "League Spartan" ...
require 'spec_helper' describe 'NS-ISA List API V2', type: :request do include_context 'V2 headers' include_context 'ScreeningList::Isa data' let(:v2_headers) { { 'Accept' => 'application/vnd.tradegov.webservices.v2' } } describe 'GET /consolidated_screening_list/search?sources=ISA' do let(:params) { { so...
class UsersController < ApplicationController before_action :set_user, only: [:show] def index @users = User.all end def new @user = User.new end def create @user = User.new(user_params) if @user.save redirect_to user_path(@user), notice: 'Registration Complete.' else ren...
module SVGen module Nestable def rect(attrs = {}) @children << Element::Rect.new(attrs) end def circle(attrs = {}) @children << Element::Circle.new(attrs) end def text(text, attrs = {}) @children << Element::Text.new(text, attrs) end def line(attrs = {}) @childre...
class CreateArtikels < ActiveRecord::Migration[6.0] def change create_table :artikels do |t| t.string :artikelname t.decimal :preis t.string :verkaeufer t.integer :anzahl t.string :marke t.string :artikelnummer t.text :beschreibung t.timestamps end end end
require 'rails_helper' RSpec.describe Book, :book, :type => :model do subject(:book) { create :book } context 'association' do it { should belong_to :category } it { should have_and_belong_to_many :author } it { should have_many :order_items} it { should have_many :reviews } end context...
class CityHallsController < ApplicationController before_filter :authenticate_user! before_action :set_city_hall, only: [:show, :edit, :update, :destroy] # GET /city_halls # GET /city_halls.json def index @city_halls = CityHall.all end # GET /city_halls/1 # GET /city_halls/1.json def show end ...
class RegistrationsController < ApplicationController def index render json: { meta: { message: 'Use this endpoint to register new users.' }, links: { self: registrations_url, } } end def create resource = User.new(registration_params) if resource.save ...
namespace :wire do desc 'load new ytn contents' task :new_ytn_101 => [:environment] do puts "in new_ytn task..." # WireServiceWorker.perform_async # YNewsML.new_ytn YNewsML.ytn_101 end desc 'load new ytn contents' task :new_ytn_201 => [:environment] do puts "in new_ytn task..." # W...
require 'httpclient' class GoogleOauthClient TOKEN_ENDPOINT = "https://www.googleapis.com/oauth2/v4/token" TOKENINFO_ENDPOINT = "https://www.googleapis.com/oauth2/v3/tokeninfo" def self.get_access_token(code, redirect_uri) url = TOKEN_ENDPOINT client = HTTPClient.new data = { code: code, ...
class ConsultationsController < InheritedResources::Base def build_resource_params [params.fetch(:consultation, {}).permit(:data, :hora, :medico_id, :paciente_id)] end end
class Comment < ActiveRecord::Base belongs_to :task has_many :attachments, dependent: :destroy validates_presence_of :content end
Vagrant.configure(2) do |config| config.vm.box = "ubuntu/bionic64" # access a port on your host machine (via localhost) and have all data forwarded to a port on the guest machine. config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: true # Folders on your host machine to be synced to and f...
require 'test_helper' class MessageTest < ActiveSupport::TestCase # The Message and RecipientUser models are being tested together because RecipientUser # is nested within Message and is modified by the messages controller test "should create message and recipient user" do message = Message.new message....
class AddIndexesToPhoto < ActiveRecord::Migration def self.up add_index :photos, :blog_id add_index :photos, :product_id add_index :photos, :package_id end def self.down end end
require 'pry' module Stacker class Interpreter def initialize @results = Array.new @call_chain = Array.new end def execute(item) @call_chain << item end def stack params_start = 0 @call_chain.each_with_index do |item, index| # Need to handle the '=' explict...
class PiecesController < ApplicationController def show @piece = Piece.find(params[:id]) render json: @piece end def update x = params[:x_position].to_i y = params[:y_position].to_i @piece = Piece.find(params[:id]) game_id = @piece.game_id game = Game.find(game_id) unles...
# redMine - project management software # Copyright (C) 2006-2008 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your optio...
# frozen_string_literal: true module GraphQLPreload class EntityLoader < BaseLoader private def association_loaded?(entity) entity.model.association(@association).loaded? end def preload_association(entities) records = entities.map(&:model) ActiveRecord::Associations::Preloader.ne...
# -*- mode: ruby -*- # vi: set ft=ruby : # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provider "docker" do |d| d.has_ssh = true d.build_dir = "." d.remains_running = false ...
class AddDateToSpinClass < ActiveRecord::Migration[5.2] def change add_column :spin_classes, :start, :datetime add_column :spin_classes, :end, :datetime end end
require 'rails_helper' describe "Preferences", type: :feature do let(:industry) { Industry.create(title: "Technology") } let(:career) { Career.create(industry_id: industry.id, title: "Software Developer", description: "Develop, create, and modify general computer applications software or specialized utility prog...
# Provides limited CRUD for Adjustments, which are the way that Diaper Banks fix incorrect inventory totals at Storage Locations class AdjustmentsController < ApplicationController # GET /adjustments # GET /adjustments.json def index setup_date_range_picker @selected_location = filter_params[:at_locatio...
class MomentumCms::FieldTemplate < ActiveRecord::Base # == MomentumCms ========================================================== self.table_name = 'momentum_cms_field_templates' # == Constants ============================================================ # == Relationships ====================================...
class NPRNews::CLI def call welcome divisions division_choice end def welcome puts "Welcome to an unofficial NPR News Feed" puts "All content, copyright NPR News" end def divisions @divisions = NPRNews::Divisions.division divisions_display end def divisions_display @div...
# == Schema Information # # Table name: spreads # # id :bigint(8) not null, primary key # issue_id :bigint(8) # left_page_id :integer # right_page_id :integer # ad_box_id :integer # color_page :boolean # width :float # height :float # left_margin :float # top_ma...
class Shakeshop def initialize @milkshakes = [] end def add_milkshake(milkshake) @milkshakes << milkshake end def checkout total_order_price = 0 @milkshakes.each do |milkshake| total_order_price += milkshake.price_of_milkshake end total_order_price end end class MilkShake def initialize ...
FactoryBot.define do factory :comment do content {Faker::Lorem.characters Settings.factories.comment.content} end end
#require 'spec_helper' require "rails_helper" describe Section do let(:section_instance) { build(:section) } it 'has a valid factory' do expect(section_instance).to be_valid end describe 'ActiveModel validations' do it { expect(section_instance).to validate_presence_of(:description) } it { expect...
class ChangeDataTypeOfUsageCount < ActiveRecord::Migration def change rename_column :invite_codes, :consumed, :usage change_column :invite_codes, :usage, :integer end end
class EventsController < ApplicationController def index @future_events = Event.all.where('start_time > ?', DateTime.now) @current_events = Event.all.where('start_time < ?', DateTime.now).where('end_time > ?', DateTime.now) end def show end def create @event = Event.new(event_params) sess...
namespace :exchanges do desc "Cleanse exchanges" task :cleanse => :environment do Rails.logger.info " " Rails.logger.info "Started Exchanges Cleanse task" Rails.logger.info " " Exchange.where(address: nil, business_type: :exchange).destroy_all # Should match exchange.rb's before_create ...
# frozen_string_literal: true require 'dry/effects' require 'dry/monads' RSpec.configure do |config| config.include Dry::Effects::Handler.CurrentTime #, effects: :current_time config.include Dry::Effects.CurrentTime #, effects: :current_time config.around { |ex| with_current_time(&ex) } config.expect_with :...
FactoryGirl.define do factory :aspect do name { Faker::Lorem.word } description { Faker::Lorem.paragraph} aspectable_id { 1 } aspectable_type {'Npc'} end end
class HourlySample < ActiveRecord::Base belongs_to :station validates_presence_of :station scope :availability, lambda { select { [HOUR(created_at).as(:hour), :used, :unused] } } scope :punchcard, lambda { select { [ WEEKDAY(created_at).as(:day), HOUR(created_at).as(:hour), A...
require 'rails_helper' RSpec.feature ResponsibleBody do let(:sign_in_page) { PageObjects::SignInPage.new } let(:responsible_body_home_page) { PageObjects::ResponsibleBody::HomePage.new } let(:responsible_body) { create(:local_authority) } let(:rb_user) { create(:local_authority_user, responsible_body: respons...
class AddPresentInforIndexToBlesses < ActiveRecord::Migration def change add_index :blesses, :virtual_present_infor, using: :gin end end
class AddExactWeightToWeightTracker < ActiveRecord::Migration[5.0] def change add_column :weight_entries, :exact_weight, :float end end
Vagrant.configure("2") do |config| 1.upto(4) do |n| node_name = "node#{n}" config.vm.define node_name do |node| node.vm.hostname = node_name node.vm.box = "precise32" node.vm.box_url = "http://files.vagrantup.com/precise32.box" node.vm.synced_folder ".", "/opt/vagrant-play" nod...
module York class ArchiveUrlTag < Liquid::Tag def render(context) example = context.registers[EXAMPLE_REGISTER] || '' site = context.registers[:site] site_dest = Pathname.new(site.dest) pathname = York.path_to_archive(site, example, extension) '/' + pathname.relative_path_f...
class Customer < ApplicationRecord has_many :payments validates :published_on, :presence => true accepts_nested_attributes_for :payments, :allow_destroy => true end
class Bs::GradeSerializer < ActiveModel::Serializer attributes :id, :name, :level has_many :performances has_many :attendances end
class Product < ActiveRecord::Base attr_accessible :description, :image_url, :name, :price, :seller_id, :category_ids validates :image_url, :name, :price, :seller_id, :presence => true belongs_to :user, :foreign_key => :seller_id has_many :category_products, :class_name => "CategoryProduct", :primary_k...
#!/usr/bin/ruby -w require 'getoptlong' def help puts "Usage: #{$0} [options]" puts "\t-h --help\t\tthis help." puts "\t-f --file\t\toutput file." puts "\t-n --num\t\tcharset: 0123456789" puts "\t-a --alpha\t\tcharset: abcdefghijklmnopqrstuvwxyz" puts "\t-A --alphamaj\t\tcharset: ABCDEFGHIJKLMNOPQRSTUVWXYZ" pu...
# frozen_string_literal: true module BCommerce module ServerToServer RSpec.describe Cart do let(:attributes) { { customer_id: { type: Integer}, line_items: { type: Array, validate_with: :validate_line_items }, gift...
class ApiWiki include Mongoid::Document include ActiveModel::Serialization include Slugifiable field :name, type: String field :documentation, type: String field :slug, type: String validates :slug, uniqueness: {message: ': "%{value}" is already taken'}, exclusion: { in: [ "api", "new", "dataset" ], mess...
# # Cookbook Name:: mr-chef # Recipe:: default # # Copyright 2013, YOUR_COMPANY_NAME # # All rights reserved - Do Not Redistribute # execute "add rbenv path" do user "#{node['user']['name']}" command "echo 'eval \"$(rbenv init -)\"' >> ~/.bash_profile" command "echo 'PATH=$PATH:/usr/local/rbenv/bin/rbenv' >> ~/.b...
class ProgrammingLanguage attr_reader :name def initialize(name ='Ruby') @name = name end RSpec.describe ProgrammingLanguage do let(:language) { ProgrammingLanguage.new('Python') } it 'should store the name of the language' do expect(language.name).to eq('Python') end context 'with...
require 'colorize' class ColorString attr_accessor :error def initialize(error = []) @error = error end def print_error(path) number_of_error = @error.size if number_of_error.zero? puts '-----------------------------------------'.colorize(:green) puts "There is #{number_of_error} Numb...
require 'minitest/autorun' require '../lib/card' require '../lib/deck' class DeckTest < Minitest::Test def setup @card1 = Card.new(:diamond, 'Queen', 12) @card2 = Card.new(:spade, '3', 3) @card3 = Card.new(:heart, 'Ace', 14) @cards = [@card1, @card2, @card3] @deck = Deck.new(@cards) end def...
require 'rails_helper' describe Comment do it { should belong_to :article } it { should validate_presence_of :user } it { should validate_presence_of :content } end
require_relative('../db/sql_runner') class Student attr_accessor :first_name, :last_name, :house_id, :age attr_reader :id def initialize(student_details) @id = student_details['id'].to_i if student_details['id'] @first_name = student_details['first_name'] @last_name = student_details['last_name'] ...
require 'spec_helper' describe V1::UserActivitiesController do render_views let(:user) { create(:user) } let(:activity) { create(:activity) } let(:user_activity) { create(:user_activity) } describe "POST 'create'" do it "returns http success if parameters are valid" do ...
#Szymon Nosal #C2Z6.rb #Proszę napisać klasę „Complex” liczb zespolonych. #Konstruktor klasy powinien być zdefiniowany z parametrami a, b typu rzeczywistego umożliwiającymi nadanie egzemplarzowi klasy wartości np. -6.4+7.8i. # Jeżeli podamy jeden argument ma zostać stworzona liczba a+0i # Zdefiniować metodę to_s, któr...
require 'spec_helper' describe interface('eth0') do it { should exist } it { should be_up } it { should have_ipv4_address('192.168.100.2')} end describe file('/etc/resolv.conf') do it { should be_file } it { should contain "nameserver 192.168.100.2"} end describe host('google.com') do it { should b...
class RegistrationChanges < ActiveRecord::Migration def self.up add_column :registrations, :revision, :boolean add_column :registrations, :complexity, :integer add_column :trips, :complexity_minutes, :integer, :default => 30, :null => false end def self.down remove_column :trips, :complexity_minu...
require "spec_helper" require "fileutils" RSpec.describe IsoDoc::ITU do it "processes IsoXML bibliographies (1)" do input = <<~INPUT <iso-standard xmlns="http://riboseinc.com/isoxml"> <bibdata> <language>en</language> </bibdata> <preface><foreword> <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f...
class User < ActiveRecord::Base has_many :categories #User.first.books_added show book title & author that User added in Category has_many :books_added, through: :categories, source: :book has_secure_password EMAIL_REGEX = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]+)\z/i validates :email, uniqueness: { case_sens...
module TroleGroups::Macros class Configuration class StorageLoader < BaseLoader def initialize strategy, orm super end def storage_class begin "#{orm_namespace}::Storage::#{strategy.to_s.camelize}".constantize rescue # use generic if no ORM specifi...
#encoding: utf-8 class Customer < ActiveRecord::Base set_table_name :"lantan_db_all.customers" set_primary_key "id" has_many :customer_num_relations has_many :c_svc_relations has_many :c_pcard_relations has_many :revisits has_many :send_messages has_many :c_svc_relations #客户状态 STATUS = {:NOMAL => 0...
FactoryGirl.define do factory :store do name 'Amazon' end factory :department do sequence(:name) { |n| "Department #{n}" } end factory :platform do department sequence(:name) { |n| "Platform #{n}" } end factory :item do department sequence(:title) { |n| "Title #{n}" }...
class TeacherDetailsController < ApplicationController load_and_authorize_resource # GET /teacher_details # GET /teacher_details.xml def index @teacher_details = TeacherDetail.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @teacher_details } end e...
class MaterialsController < ApplicationController load_and_authorize_resource :course load_and_authorize_resource :section, :through => :course load_and_authorize_resource :material, :through => :section before_filter only: [:edit, :new] do |action| add_breadcrumb @course.name, @course end def show ...
module Spec module Rails module Matchers def require_a_unique(attribute, scope = nil) return simple_matcher("model to require a unique #{attribute}") do |model| if model.is_a?(Class) clazz = model model = Factory.build(:"#{clazz.name.underscore}") else ...
require 'jekyll' require 'net/http' require 'uri' require 'json' require 'jekyll_pocket_links/pocket_error' module JekyllPocketLinks class RenderPocketTag < Liquid::Tag def fetchPocketList(pocket_access_token, pocket_consumer_key) pocket_get_uri = 'https://getpocket.com/v3/get' pocket_get_options = ...
class BalanceEntry < ActiveRecord::Base belongs_to :bill belongs_to :shareholder belongs_to :account belongs_to :account_entry has_paper_trail validates_presence_of :account_id validates_presence_of :amount validates_presence_of :date scope :unique_shareholders, -> { select(:shareholder_id).where...
class Event < ActiveRecord::Base belongs_to :user has_many :attendees, dependent: :destroy has_many :users_attending, through: :attendees, source: :user end
class FormatsController < ApplicationController load_and_authorize_resource def index @format = Format.new end def create Format.create(format_params) unless Format.find_by(format_params) redirect_to(formats_path) end def update @format.update(format_params) redirect_to @format end ...
describe "Records API" do describe "GET /api/records" do it "returns all the records" do FactoryGirl.create :record, title: "Coit Tower" FactoryGirl.create :record, title: "Inspiration Point" get "/api/records" expect(response.status).to eq 200 record_titles = body['records'].map ...
class Customer < ApplicationRecord belongs_to :client has_many :booking_requests, dependent: :nullify end
class SessionsDatatable include Rails.application.routes.url_helpers delegate :params, :h, :link_to, :number_to_currency, :number_with_delimiter, to: :@view delegate :current_user, to: :@current_user delegate :matches_only, to: :@matches_only delegate :session, to: :@session delegate :agenda_id, to: :@agend...
class Website < ApplicationRecord belongs_to :user has_many :pages, dependent: :destroy validates :url, presence: true, url: true after_create :check_website, unless: :skip_callbacks def self.scanned_latest(user) websites = [] return unless user if user.admin? urls = Website.all.distinct...
class AddFieldsToUsers < ActiveRecord::Migration[5.0] def change add_column :users, :login, :string add_column :users, :fio, :string add_column :users, :dob, :date add_column :users, :document_type, :string add_column :users, :document_num, :string add_column :users, :phone_num, :string end ...
class Activity attr_reader :what_to_do, :participants, :cost def initialize(what_to_do) @what_to_do = what_to_do @participants = {} @cost = 0 end def adding_activities @participants[hiking] = @cost [climbing] = @cost end end
class Contact < MailForm::Base attribute :name, :validate => true attribute :email, :validate => true validates_format_of :email, :with => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i attributes :nickname, :captcha => true attribute :message def headers { :to => "ernane.sena@gmail.com...
class School attr_accessor :roster, :name, :school def initialize(school) @roster = {} @school = school end def add_student(name, grade) if @roster[grade] # roster is empty @roster[grade] << name #add key with array as value, and student in array ...
json.array! @rooms do |room| user = room.users.where.not(id: current_user.id).first json.extract! user, :id, :email, :first_name, :last_name if user.user_images.exists? then json.image polymorphic_url(user.user_images.first.profile_image) else json.image '/assets/icon.png' end end