text stringlengths 10 2.61M |
|---|
# encoding: UTF-8
# Cookbook Name:: chef-dev-workstation
# Recipe:: linux_setup
#
adminuser = node['admin']['username']
##############################################################################
# First create an admin user
##############################################################################
group adminu... |
class Teams < ROM::Relation[:sql]
schema(:teams, infer: true)
def by_id(id)
where(id: id)
end
def all
order(:id)
end
end
|
class Me::AccountsController < ApplicationAPIController
before_action :doorkeeper_authorize!
def index
@accounts = current_user.accounts
end
def update
if request.put?
@account = current_user.accounts.find_or_initialize_by(uid: params[:id])
@account.assign_attributes(empty_account_param_se... |
module Locomotive
module Api
class ContentEntriesController < BaseController
before_filter :set_content_type
def index
@content_entries = @content_type.ordered_entries
respond_with @content_entries
end
def show
@content_entry = @content_type.entries.any_of({ :_id... |
class AddExtendingOrganisationDetailsToActivities < ActiveRecord::Migration[6.0]
def change
change_table :activities do |t|
t.string :extending_organisation_name
t.string :extending_organisation_reference
t.string :extending_organisation_type
end
end
end
|
require_relative 'spec_helper'
require 'quickmr/multiplexer'
describe Multiplexer do
subject do
Multiplexer
end
class TestProcessor
def initialize
@events = []
end
attr_accessor :events
def deliver_message!(*args)
@events << args
end
end
it 'should output input data to all processors in roun... |
class Tag < ApplicationRecord
validates_presence_of :title
has_many :jobs
end
|
class Hanoi
def initialize
@board = Array.new(3) {[]}
@game_over = false
end
def board
@board
end
def board=(num)
@board[0] += (1..num).to_a
end
def get_input
p "Enter position separated by a space like this ! '0 1'"
pos = gets.chomp.s... |
require "io/console"
class TTYApp
CSI = "\e["
CTRL_C = ?\C-c
CTRL_Z = ?\C-z
def initialize(tty, &run_loop)
@tty = tty
@run_loop = run_loop
end
def start
@stopped = false
trap_signals
@tty.raw do |io|
io.write(hide_cursor)
until @stopped
@run_loop.call(self)
... |
require 'spec_helper'
describe Metasploit::Model::Module::Instance,
# setting the metadata type makes rspec-rails include RSpec::Rails::ModelExampleGroup, which includes a better
# be_valid matcher that will print full error messages
type: :model do
subject(:module_instance) do
Factory... |
# frozen_string_literal: true
FactoryBot.define do
factory :thermostat do
household_token { Faker::Internet.uuid }
location { Faker::Address.full_address }
end
end
|
require 'spec_helper'
describe "locations" do
let(:location) {create(:location)}
let(:admin) {create(:admin)}
let(:post) {create(:post, :with_location)}
let(:post1) {create(:post)}
before do
RubyCAS::Filter.fake(admin.onid)
visit signin_path
visit root_path
end
context "when there is a post ... |
class VirtuesController < ApplicationController
def index
@virtues = Virtue.all
end
def show
@virtue = Virtue.find(params[:id])
end
end
|
class TestAuthentication
def response_code
auth = {
auth_code: create_auth_code
}
end
def create_auth_code
"auth_code"
end
def check_parameter(params: params)
if params[:client_id] != "hoge"
return "invalid_client_id"
end
if params[:redirect_url] != "fuga"
return... |
class BroadcastsController < ApplicationController
before_filter :authenticate_user!, :clear_cache
def create
@broadcast = current_user.station.broadcasts.create(song_id: params[:song_id])
@locals = { :action => 'remove', :id => params[:song_id], :counter => :add }
respond_to do |format|
... |
require('pg')
class Property
attr_accessor :address, :value, :build, :rooms
attr_reader :id
def initialize(options)
@id = options['id'] if options['id']
@address = options['address']
@value = options['value']
@build = options['build']
@rooms = options['rooms'].to_i
end
def save
db =... |
class Exercise
# Assume that "str" is a sequence of words separated by spaces.
# Return a string in which every word in "str" that exceeds 4 characters is replaced with "marklar".
# If the word being replaced has a capital first letter, it should instead be replaced with "Marklar".
def self.marklar(str)
#sp... |
# The MIT License
#
# Copyright (c) 2011 Nathan Ehresman
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify,... |
require "test_helper"
class ProductTest < ActiveSupport::TestCase
fixtures :products
test "product attributes must not be empty" do
product = Product.new
assert product.invalid?
assert product.errors[:title].any?
assert product.errors[:description].any?
assert product.errors[:price].any?
a... |
class Manage::UsersController < ManageController
before_action :require_login
before_action :set_user, only: [:show, :edit, :update]
def index
count = params[:count] || 20
page = params[:page] || 1
nonpaged_users = Index::User.all
@users = nonpaged_users.page(page).per(count).includes(:school)
end
def ... |
require File.join(File.dirname(__FILE__), '..', "spec_helper")
require "rspec/matchers/dm/has_and_belongs_to_many"
describe DataMapperMatchers::HasAndBelongsToMany do
it "should pass for for working association" do
Post.should has_and_belongs_to_many :tags
end
it "should fail if we expect existing rela... |
class Location < ActiveRecord::Base
mount_uploader :image, LocationImageUploader
acts_as_gmappable :process_geocoding => :geocode?
include ImageModel
attr_accessible :address, :city, :latitude, :longitude, :postal_code, :image, :name, :description, :city_id, :translations_attributes
translates :name, :descr... |
# frozen_string_literal: true
class ChangeNotNullToNullOrderproductlist < ActiveRecord::Migration[6.0]
def change
change_column_null :orderproductlists, :product_id, true
change_column_null :orderproductlists, :order_id, true
end
end
|
class Product < ApplicationRecord
has_many :purchased_products
has_many :purchased, through: :purchased_products
end
|
class OrdersController < ApplicationController
def index
@orders = Order.full_orders
end
def create
order = Order.new(orders_params)
order.employee = employee_logged_in
if order.save
flash.clear
redirect_to new_part_path
else
@errors = order.errors.full_messages
render... |
# frozen_string_literal: true
class ChangeTypeOfDatebirth < ActiveRecord::Migration[6.1]
def change
change_column :cats, :date_of_birth, :date
end
end
|
%w{ models }.each do |dir|
path = File.join(File.dirname(__FILE__), 'app', dir)
$LOAD_PATH << path
ActiveSupport::Dependencies.autoload_paths << path
ActiveSupport::Dependencies.autoload_once_paths.delete(path)
end
module EventLogger
def self.current_request
event_logger_store[:current_request]
end
... |
#!/usr/bin/env ruby
$: << File.join(File.dirname(__FILE__), '../spec')
require 'support/aws_utils'
require 'optparse'
def parse_options
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: aws [options] command ..."
opts.on("-a", "--access-key-id=ID", "AWS access key ID") do |v|
options[:... |
# require 'test_helper'
# class QueryTest < ActionDispatch::IntegrationTest
# setup do
# @shop = Shop.create!(name: 'Body Store')
# @method = @shop.methods.create!(name: 'Motoboy')
# end
# test "quotation from zip rules" do
# @method.zip_rules.create!([
# { range: 1..5, price: 15.0, deadline: ... |
require "rails_helper"
RSpec.describe RegionAccess, type: :model do
let(:manager) { create(:admin, :manager, full_name: "manager") }
context "accessing from User" do
it "can be accessed via user" do
expect(User.new(access_level: :manager).region_access).to be_instance_of(RegionAccess)
end
it "i... |
require 'eventmachine'
require 'em-http-request'
module JanusGateway
class Transport::Http < Transport
attr_reader :transaction_queue
# @param [String] url
def initialize(url)
@url = url
@transaction_queue = {}
end
def run
EventMachine.run do
EM.error_handler { |e| rai... |
#Question 1
ages = { "Herman" => 32, "Lily" => 30, "Grandpa" => 402, "Eddie" => 10 }
puts ages.has_key?('Spot')
# Question 2
munsters_description = "The Munsters are creepy in a good way."
puts munsters_description.capitalize
puts munsters_description.swapcase
puts munsters_description.downcase
puts munsters_desc... |
# frozen_string_literal: true
module View
module Game
class EntityOrder < Snabberb::Component
needs :round
def render
divs = @round.entities.map.with_index do |entity, index|
entity_props = {
key: "entity_#{index}",
style: {
display: 'inline-bl... |
module SoramimiLyrics
class Song
def initialize(*args)
# Do a manual args.extract_options! - we can't rely on
# activesupport being present.
options = (args.last.is_a?(::Hash) ? args.pop : {})
input = args.pop
options[:format] ||= :soramimi
@timecodes = case options[:format... |
require_relative 'fixture'
RSpec.configure do |config|
config.include Rounders::Test::Fixture
end
module Rounders
module Rspec
# Fake class to document RSpec Rails configuration options. In practice,
# these are dynamically added to the normal RSpec configuration object.
class Configuration
end
... |
RSpec.describe "operation with nested responses" do
# see Test::Client definition in `/spec/support/test_client.rb`
before do
class Test::User < Evil::Struct
attribute :name
end
class Test::Client < Evil::Client
operation do
http_method :get
path { "users" }
respons... |
require_relative '../lib/maybe_client'
require 'timecop'
describe MaybeClient do
let(:client_class) { double('client class') }
let(:connect_params) { 'connect params can be string or hash or anything' }
let(:client) { double('client') }
let(:result) { double('result') }
context 'initializing the client insi... |
require 'etcd'
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'puppet_x', 'etcd', 'etcd_config.rb'))
Puppet::Type.type(:etcd_key).provide(:etcd_v2_api) do
desc "Provides etcd_key management using the etcd v2 api. Requires the 'etcd' gem to operate."
def initialize(value = {})
supe... |
class Human
attr_accessor :strength, :intelligence, :stealth, :health
def initialize
@strength = 3
@intelligence = 3
@stealth = 3
@health = 100
end
def attack(object)
if object.class.ancestors.include?(Human)
object.health -= 10
true
... |
require 'formula'
class Numpy < Formula
homepage 'http://numpy.scipy.org/'
url 'http://downloads.sourceforge.net/project/numpy/NumPy/1.6.1/numpy-1.6.1.tar.gz'
md5 '2bce18c08fc4fce461656f0f4dd9103e'
# Patch per discussion at: http://projects.scipy.org/numpy/ticket/1926
def patches
"https://github.com/num... |
require 'spec_helper'
require 'spec/killbill/helpers/transaction_spec'
module Killbill #:nodoc:
module Test #:nodoc:
class TestResponse < ::Killbill::Plugin::ActiveMerchant::ActiveRecord::Response
self.table_name = 'test_responses'
has_one :test_transaction
end
end
end
describe Killbill::Pl... |
class User < ApplicationRecord
has_many :user_shows
has_many :shows, through: :user_shows
validates_presence_of :username, :password_digest
validates :username, uniqueness: true
has_secure_password
end
|
class Computer
include ActiveModel::Dirty
# 変更を検知したい属性名を指定
define_attribute_methods :name
# getter
def name
@name
end
# setter
def name=(value)
# xxx_will_change! 特定のカラムの変更状態を追跡
name_will_change! unless value == @name
@name = value
end
def save
# 前回の変更箇所と値を @previously_change... |
class Star < Element
include ZOrdered
ANIMATION = G::Image::load_tiles(Game.instance, "media/Star.png", 25, 25, false)
def initialize
@color = random_color
@x, @y = random_warp
end
def draw
image = ANIMATION[G::milliseconds / 100 % ANIMATION.size]
image.draw(
@x - image.width / 2.0,... |
module Endeca
YAML.add_domain_type("yaml.org,2002","java.util.HashMap") do |type,val|
Endeca::HashWithMethods[ val ]
end
YAML.add_domain_type("yaml.org,2002","java.lang.Long") do |type,val|
val.to_i
end
class Request < Endeca::HashWithMethods
RUN_QUERY_METHOD = 'endeca.runQuery'
... |
require 'rails_helper'
RSpec.describe User, type: :model do
it '名前、メールアドレス、パスワードが指定の入力値であれば、invalidしないかどうか' do
user = User.new(
name:"testマン",
email:"test@gmail.com",
password:"testtest"
)
expect(user).to be_valid
end
it "名前に入力がなければエラーメッセージが出るかどうか" do
user = User.new(name: ni... |
class ApplicationController < ActionController::API
include ActionController::HttpAuthentication::Token::ControllerMethods
include Pundit
before_action :authenticate
def aunthenticate
authenticate_token || unauthorized
end
def autheticate_token
authenticate_with_http_token do |token, options|
@api_key ... |
# frozen_string_literal: true
module Dynflow
module Executors
module Sidekiq
module RedisLocking
REDIS_LOCK_KEY = 'dynflow_orchestrator_uuid'
REDIS_LOCK_TTL = 60
REDIS_LOCK_POLL_INTERVAL = 15
ACQUIRE_OK = 0
ACQUIRE_MISSING = 1
ACQUIRE_TAKEN = 2
RELEA... |
# -*- coding: utf-8 -*-
require_relative 'cell'
class Universe
attr_accessor :matrix
def initialize(total)
@matrix = Array.new(total) { Array.new(total) }
end
def fillUniverse
@matrix.count.times do |x|
@matrix.count.times do |y|
@matrix[x][y] = Cell.new(x,y,Random.rand(2))
print "#{x}... |
require 'cells_helper'
RSpec.describe Abroaders::Cell::Layout::Sidebar do
let(:sidebar) { described_class }
example '.show?' do
admin = Admin.new
acc = Account.new
# no-one signed in:
expect(sidebar.(nil, {}).show?).to be false
# admin signed in:
expect(sidebar.(nil, current_admin: admin... |
#==============================================================================
# ** Game_CharacterBase
#------------------------------------------------------------------------------
# This base class handles characters. It retains basic information, such as
# coordinates and graphics, shared by all characters.
#===... |
class Section < ActiveRecord::Base
include RankedModel
belongs_to :phase
has_many :section_steps, :dependent => :destroy
validates_presence_of :name
ranks :row_order, :with_same => :phase_id
acts_as_url :name, :url_attribute => :slug
def to_param
slug
end
def next_section
phase.sections.r... |
task :default => :test
configatron.product_name = "PayPalHttp Java"
# Custom validations
def package_version
File.open("build.gradle", 'r') do |f|
f.each_line do |line|
if line.match (/version \'\d+.\d+.\d+'/)
return line.strip.split('\'')[1]
end
end
end
end
def validate_version_match
if package_ve... |
# frozen_string_literal: true
# @author Fernando Vieira do http://simplesideias.com.br
module Brcobranca # :nodoc:[all]
module Currency # :nodoc:[all]
# Implementação feita por Fernando Vieira do http://simplesideias.com.br
# post http://simplesideias.com.br/usando-number_to_currency-em-modelos-no-rails
... |
class SurveysController < ApplicationController
def index
@surveys = Survey.all
end
def show
@survey = Survey.find(params[:id])
end
def new
@survey = Survey.new
end
def create
if @survey = Survey.find_by_sg_id(params[:survey][:sg_id])
@survey.destroy
end
@survey ... |
# config valid only for current version of Capistrano
lock "3.10.0"
set :user, 'portfolio'
set :application, "portfolio"
set :repo_url, "git@github.com:khpatel4991/portfolio.git"
set :deploy_to, '/home/portfolio/frontend'
set :keep_releases, 5
set :pty, true
set :ssh_options, {
forward_agent: true,
auth_method... |
#
# Copyright 2009 Huygens Instituut for the History of the Netherlands, Den Haag, The Netherlands.
#
# This file is part of New Women Writers.
#
# New Women Writers 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 Foundat... |
require 'rails_helper'
RSpec.describe Invitation, type: :model do
let(:invitation) { Invitation.create(user_id:1, creator_id: 2, event_id: 1) }
it 'should be unique' do
should validate_uniqueness_of(:user_id).case_insensitive.scoped_to(:event_id).with_message('Can\'t send the same invitation twice')
end
it ... |
require 'rails_helper'
include Helpers
describe "User page" do
before(:each) do
ActiveRecord::Base.subclasses.each(&:delete_all)
end
it "does not allow normal users to change blocked status of users" do
create_user(username:"NameOfTheUser", password:"Password123")
create_user(username:"newUser", pa... |
class AddIncidentPictureToIncident < ActiveRecord::Migration
def change
add_column :incidents, :incident_picture, :string
end
end
|
#
#
#
#
#
#
class Craft
attr_reader :name, :supplies_required
def initialize(name, supplies_required)
@name = name
@supplies_required = supplies_required
end
end
|
class StudentController < ApplicationController
def index
@students = Recruitment.by_students.includes(:user)
end
end
|
module AdminArea::Banks
module Cell
# @!method self.call(banks, options = {})
class Index < Abroaders::Cell::Base
def title
'Banks'
end
private
def table_rows
cell(TableRow, collection: model)
end
class TableRow < Abroaders::Cell::Base
include Esc... |
require 'json'
module Bambooing
module Timesheet
module Clock
class Entry
PATH = '/timesheet/clock/entries'.freeze
attr_accessor :id, :tracking_id, :employee_id, :date, :start, :end, :note
def initialize(args)
@id = args[:id]
@tracking_id = args[:tracking_id]
... |
class AddRedirectionToCampaign < ActiveRecord::Migration
def self.up
add_column :campaigns, :redirection, :string
end
def self.down
remove_column :campaigns, :redirection
end
end
|
class JobTemplate < ActiveRecord::Base
has_many :steps, -> { order(:order) }, class_name: 'JobTemplateStep'
has_many :jobs
serialize :environment, Array
scope :cluster_job_templates, -> { where(type: self.default_type) }
def self.default_type
'ClusterJobTemplate'
end
def self.load_templates(pathna... |
require 'minitest/autorun'
require 'minitest/pride'
require 'webmock/minitest'
require 'nokogiri'
require 'xednese'
class String
def self.generate(length = 25)
chs = ('a'..'z').to_a + ('0'..'9').to_a + ('A'..'Z').to_a
(0..length).map { chs[rand(chs.size)] }.join('')
end
def pad(with, to)
(with * (to... |
require 'pry'
require './rule_based_translator.rb'
class EquationParser
extend RuleBasedTranslator
class << self
attr_accessor :to_biexp_rules
def fail
end
def string_to_array(string)
return fail unless string_valid?(string)
nested_arr, remaining = parentheses_to_array(split_equation... |
n = gets.chomp.to_i
for i in (1..n)
if i.odd?
puts i
end
end
|
class UserPolicy < ApplicationPolicy
def index?
user.is_admin?
end
def create?
user.is_admin?
end
def update?
user.is_admin?
end
def destroy?
user.is_admin? && user != record
end
def show?
user.present?
end
def reset_password?
... |
require 'spec_helper'
RSpec.describe YahooGeminiClient do
describe ".new" do
let(:client) { double(YahooGeminiClient::Client) }
let(:args) { {a: "b"} }
it "returns a YahooGeminiClient::Client" do
expect(YahooGeminiClient::Client).to receive(:new).with(args).
and_return(client)
expe... |
# frozen_string_literal: true
module Relax
module SVG
# Common methods for adding children to a
# conatainer or to an image
module Render
# Renders the container returning
# a String of xml script chunk
module RenderContainer
def render
attributes = self.class::ATTRIBU... |
# frozen_string_literal: true
module EtAzureInsights
# A factory for creating a new client configured for the request that is required
# to be made (i.e. with context set correctly)
# Also provides a global 'channel' for use by all clients as each channel
# spins up a thread for buffering the requests
class ... |
class RenameQuizToQuestion < ActiveRecord::Migration
def change
rename_table :quizzes, :questions
end
end
|
Pod::Spec.new do |spec|
spec.name = "SocialSignInKit"
spec.version = "1.0.0"
spec.summary = "SocialSignInKit is multiple social sign-in kit. Support to Apple, Google and Facebook."
spec.description = <<-DESC
SocialSignInKit is multiple social sign-in kit. Support to Apple, Google and F... |
# frozen_string_literal: true
require 'spec_helper'
describe Diplomat::Policy do
context 'Consul 1.4+' do
let(:key_url) { 'http://localhost:8500/v1/acl' }
let(:id) { '2c9e66bd-9b67-ef5b-34ac-38901e792646' }
let(:read_body) do
[
{
'ID' => id,
'Name' => 'test',
... |
class Trdsql < Formula
desc "Tools for executing SQL queries to CSV, LTSV and JSON"
homepage "https://github.com/noborus/trdsql/"
url "https://github.com/noborus/trdsql/archive/v0.7.5.tar.gz"
sha256 "abe0103fac8e176dafd7ae51765277f35f8d3974f76834e3f1497b8adcdc69e3"
depends_on "go" => :build
def install
... |
class API::TicketsController < API::ApplicationController
before_action :set_project
before_action :set_ticket, only: [ :show, :update, :destroy ]
def show
authorize @ticket, :show?
render json: @ticket
end
def create
@ticket = @project.tickets.build(ticket_params)
authorize @ticket, :create?
if @tick... |
# 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 rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
# == Schema Information
#
# Table name: galleries
#
# id :integer not null, primary key
# author_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
# title :string not null
# descrip... |
require_relative './lib/heap/max_heap.rb'
class PriorityQueue
def initialize(arr = [], max_size)
@mh = ::MaxHeap.new(arr, max_size)
end
def pop
mh.pop
end
def push(el)
mh.insert(el)
end
def <<(el)
push(el)
end
private
def mh
@mh
end
end
|
class CharacterCurseAbility < ApplicationRecord
belongs_to :curse_level
belongs_to :character
end
|
module Ability
class Admin < Ability::Base
def permissions
can :manage, :all
end
end
end
|
require "rails_helper"
RSpec.describe RejoinCall, type: :model do
describe "#call" do
it "dials the specified user into the call and updates the sid" do
call_result = CallResult.new(connected?: true, sid: "fake-sid")
adapter = spy(create_call: call_result)
user = create(:user_with_number)
... |
class CreateTanques < ActiveRecord::Migration
def change
create_table :tanques do |t|
t.references :viveiro, index: true, foreign_key: true
t.integer :identificacao, unique: true
t.float :tamanho
t.timestamps null: false
end
end
end
|
require 'pry'
require 'csv'
class Gossip
attr_accessor :auteur, :contenu
def initialize(auteur, contenu)
@auteur = auteur
@contenu = contenu
end
#cette fonction permet de sauvegarder les gossips dans la base de données en CSV
def save
CSV.open("/Users/RaphaelledeLaBouil... |
class RetailerCategoryService
class << self
include ApiClientRequests
def request_uri(options = nil)
uri = URI("#{ServiceHelper.uri_for('category', protocol = 'https', host: :external)}/categories.json")
uri.query = options.to_query if options
uri
end
def connection_details
... |
class ApplicationController < ActionController::Base
rescue_from CanCan::AccessDenied do |exception|
redirect_to authenticated_root_path, alert: exception.message
end
before_action :authenticate_user!
layout 'admin_lte_2'
protect_from_forgery with: :exception
end
|
class VoicemailMessagesController < ApplicationController
load_resource :voicemail_account
load_and_authorize_resource :voicemail_message, :through => [:voicemail_account]
before_filter :set_and_authorize_parent
before_filter :spread_breadcrumbs
helper_method :sort_column, :sort_descending
before_filt... |
class ComprasController < ApplicationController
before_action :set_compra, only: [:show, :edit, :update, :destroy]
respond_to :html
def index
@compras = Compra.all
respond_with(@compras)
end
def show
respond_with(@compra)
end
def new
@compra = Compra.new
respond_with(@compra)
end... |
# encoding: UTF-8
module QuestionsHelper
# in: a list of questions
# out: a list of lists of questions
#
# Used to group question search result sets into categories
# for display.
#
# The outer list is sorted by category (with nils bubbled to
# the top for uncategorised questions).
#
# The inner l... |
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{resmarkee}
s.version = "0.1.1"
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
s.authors = ["Brandon Calloway"]
s.date = %q{2009-12-07}
s.description = %q{Connect to Resmark Reserv... |
class Access < ApplicationRecord
belongs_to :beacon
end
|
#!/usr/bin/env ruby
# ruby script to create a directory structure from indented data.
# Two ways to use it now:
# Pass it a path to a template file.
# p = planter.new
# p.plant(path/to/template.tpl)
#
# or just call it with a simple name and it will look in ~/.planter for a template that matches that name.
# You can pu... |
module Orocos
# The Namespace mixin provides collection classes with several
# methods for namespace handling.
module Namespace
#The Delimator between the namespace and the basename.
DELIMATOR = "/"
# Sets the namespace name.
#
# @param [String] name the new names... |
class Admin::CompaniesController < Admin::AdminController
# GET /companies
# GET /companies.json
before_filter :find_parent
before_filter :parent_company
before_filter :find_company_owner
before_filter :company_admin_required, :except => [:index, :show, :employee_list, :edit, :update]
def index
@com... |
class Member::MembersController < ApplicationController
#ログインユーザーのみ
before_action :authenticate_member!
#@memberの値のセット
before_action :set_member
def show
@member = Member.find(params[:id])
end
def edit
@member = Member.find(params[:id])
end
def update
@member = current_member
if @membe... |
class Post < ApplicationRecord
belongs_to :user
has_rich_text :body
has_many :reviews, dependent: :destroy
has_many :likes, dependent: :destroy
validates :title, presence: true
validates :body, presence: true
end
|
# frozen_string_literal: true
module SC::Billing::Stripe
class Invoice < Sequel::Model(:stripe_invoices)
plugin :nested_attributes
many_to_one :user, class_name: SC::Billing.user_model
many_to_one :subscription, class: 'SC::Billing::Stripe::Subscription'
one_to_many :items, class_name: 'SC::Billing:... |
class CreateUserFiles < ActiveRecord::Migration
def self.up
create_table :user_files do |t|
t.string :uploaded_file_file_name
t.string :uploaded_file_content_type
t.integer :uploaded_file_file_size
t.datetime :uploaded_file_updated_at
t.integer :user_id
t.timestamps... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.