text
stringlengths
10
2.61M
# -*- mode: ruby -*- # vi: set ft=ruby : # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" # Setup instructions from docs/contributing.rst $ubuntu_setup_script = <<SETUP_SCRIPT cd /vagrant ./bootstrap/install-deps.sh ./bootstrap/dev/venv.sh SETUP_SCRIPT Va...
class RanksController < ApplicationController def index @users = User.find(Review.group(:user_id).order('count(user_id) desc').limit(3).pluck(:user_id)) @restaurants = Restaurant.all.each do |restaurant| restaurant.average = restaurant.average_rate end @restaurants = @restaurants.sort_by { |r...
# MiniTest suite for the application's Model require 'rubygems' require 'minitest/spec' require 'blog.rb' MiniTest::Unit.autorun SECONDS_PER_DAY = 60 * 60 * 24 describe Tag do before do @tags = Hash.new @tagged = [Object.new, Object.new, Object.new ] %w(foo bar quux).each_with_index do |tn,idx| t...
module Rails class ContentAssistant IRubyIndexConstants = com.aptana.ruby.core.index.IRubyIndexConstants # CoreStubber = com.aptana.ruby.internal.core.index.CoreStubber SearchPattern = com.aptana.index.core.SearchPattern IndexManager = com.aptana.index.core.IndexManager RubyLaunchingPlugin = ...
require 'spec_helper' require 'base64' describe Api do it "should have a class method to return the API version for a service" do Api.version_for(:auth).should match /v[0-9]+/ end describe ".call" do it "should handle GET" do stub_request(:get, "http://example.com/v1/api_users"). w...
class CreateProjectOpenings < ActiveRecord::Migration def change create_table :project_openings do |t| t.integer :project_id, :null => false t.integer :user_id, :null => false t.integer :touched t.timestamps end add_index :project_openings, :project_id add_index :project_...
FactoryBot.define do factory :student do first_name { "Daenerys" } last_name { "Targaryen" } end end
require 'spec_helper' describe "tailgate_venues/index" do before(:each) do @theVenue = stub_model(Venue, name:"joes") @theTailgate = stub_model(Tailgate, name:"party") assign(:tailgate_venues, [ stub_model(TailgateVenue, :tailgate => @theTailgate, :venue => @theVenue, :latit...
# -*- mode: ruby -*- # vi: set ft=ruby : disk = './secondDisk.vdi' Vagrant.configure(2) do |config| config.vm.box = "centos/7" config.vm.define "server" do |server| server.vm.network "private_network", ip: "192.168.10.10" server.vm.provider "virtualbox" do |v| v.memory = 1024 v.cpus = 2 e...
require 'spec_helper' require 'file_db' describe FileDB do let(:testfile) { 'spec/fixtures/csv/testfile.csv' } it 'opens a csv file' do expect(FileDB.open(testfile)).to be_truthy end it 'reads a csv file' do expect(FileDB.read(testfile)).to be_truthy end end
class AddPhoneNumberToClients < ActiveRecord::Migration def change add_column :clients, :contact_number, :string end end
FactoryGirl.define do factory :user do email name surname password password_confirmation { password } confirmation_token { Concerns::Token.generate } end end
module Supersaas class User < BaseModel ROLES = [3, 4, -1] attr_accessor :address, :country, :created_on, :credit, :email, :field_1, :field_2, :fk, :full_name, :id, :mobile, :name, :phone, :role, :super_field attr_reader :form def form=(value) if value.is_a?(Hash) @form = Supersaas::Fo...
require 'telegram/bot' require 'dotenv/load' LIB_PATH = "lib" Dir.foreach(LIB_PATH){|f| require_relative File.join(LIB_PATH,f) if f =~ /.*\.rb/} COMMANDS = {"/make_gif": ContentProvideWayCommand, "/start": Start, "/help": Help} def content_for_gif? bot, message return MakeGifFromUrlCommand.new(bot, message, message...
require 'bulutfon_sdk/rest/base_request' module BulutfonSDK module REST class AutomaticCall < BaseRequest def initialize(*args) super(*args) @resource = 'automatic-calls' end def all( params = {} ) prepare_request( 'get', @resource, params) end def get( id...
require 'spec_helper' RSpec.describe Manufacturer do include Helpers::DrugHelpers before :each do setup_drug_data @m1_d1 = Manufacturer.create(name:'RonCo',product_ndc:'16590-843') @m1_d2 = Manufacturer.create(name:'RonCo',product_ndc:'0069-4200') @m2_d1 = Manufacturer.create(name:'BobCo',produc...
require 'fancy_logger' require 'pathname' begin require 'bundler/setup' require 'bundler/gem_tasks' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end $logger = FancyLogger.new(STDOUT) $project_path = Pathname.new(__FILE__).dirname.expand_path $spec =...
class GradebookRemark < ActiveRecord::Base belongs_to :student belongs_to :batch belongs_to :reportable, :polymorphic => :true belongs_to :remarkable, :polymorphic => :true REMARK_TYPES = {"RemarkSet" => "General Remarks", "Subject" => "Subject-Wise Remarks"} REPORT_TYPES = {"AssessmentGroup" => "Exam", ...
require('rspec') require('word') describe(Word) do before() do Word.clear() end describe('#word_name') do it("returns the word") do test_word = Word.new(:word_name => "Sherman") expect(test_word.word_name()).to(eq("Sherman")) end end describe('#id') do it("returns the id of the wor...
class Computacenter::TechSourceMaintenanceBannerComponent < ViewComponent::Base DATE_TIME_FORMAT = '%A %-d %B %I:%M%P'.freeze def initialize(techsource) @techsource = techsource end def message supplier_outage = @techsource.current_supplier_outage if supplier_outage "The TechSource website ...
require 'pry' class Game attr_accessor :board, :player_1, :player_2 WIN_COMBINATIONS = [ [0,1,2], #top row horizontal, WIN_COMBINATIONS[0] IN OTHER WORDS THIS IS THE SAME AS COMBO[0] [3,4,5], #middle row horizontal COMBO[0] == 3 [6,7,8], #bottom row horizontal [0,3,6], #left-side vertical [1,4...
require 'rails_helper' describe Staff::AccountsController do context 'ログイン前' do it_behaves_like 'a protected singular staff controller' end context 'ログイン後' do describe '#update' do let!(:params_hash) { attributes_for(:staff_member) } let!(:staff_member) { create(:staff_member) } befor...
require 'rails_helper' describe TextMessage, type: :model do it { should validate_presence_of :number_from } it { should validate_presence_of :number_to } describe 'automatically sets number_to and number_from' do context 'the message is inbound' do let('message') { create :text_message, inbound: true...
module GaleShapley class Pool def initialize(entities) end # TODO API: delete / include / Add / any? / get first end class Algo attr_reader :companies, :professionals def initialize(companies, professionals) @companies = companies @professionals = professionals if $DEBUG ...
class Project < ActiveRecord::Base belongs_to :apm belongs_to :teamlead belongs_to :developer end
class MemberProfileRegistrationsController < DeviseRegistrationsController layout "centered", only: [:new, :create] def create ensure_can_register_as_role build_resource(sign_up_params) # binding.pry if resource.save current_user.move_to_profile(resource) if resource.active_for_authenti...
MRuby::Gem::Specification.new('mitamae') do |spec| spec.license = 'MIT' spec.author = [ 'Takashi Kokubun', 'Ryota Arai', ] spec.summary = 'mitamae' spec.bins = ['mitamae'] spec.add_dependency 'mruby-enumerator', core: 'mruby-enumerator' spec.add_dependency 'mruby-eval', core: 'mruby-e...
require 'ant' namespace :ivy do ivy_install_version = '2.2.0' ivy_jar_dir = './.ivy' ivy_jar_file = "#{ivy_jar_dir}/ivy.jar" task :download do mkdir_p ivy_jar_dir ant.get :src => "http://repo1.maven.org/maven2/org/apache/ivy/ivy/#{ivy_install_version}/ivy-#{ivy_install_version}.jar", :dest => iv...
class DropWorkshops < ActiveRecord::Migration def up drop_table :workshops end def down create_table :workshops do |t| t.string :title t.text :body t.float :atar t.float :price t.string :file t.string :preview t.string :display t.timestamps end end e...
module Crawler module UrlFrontier # Maintains and provides URL class FrontQueue def self.load_seed(path) seeds = [] comment = /#.*\Z/ File.read(path).each_line do |line| line = line.chomp.gsub(comment, '').strip next if line.empty? begin ...
class NotesController < ApplicationController def index notes = policy_scope Note authorize notes render json: notes end def create note = Note.new authorize note note.assign_attributes(permitted_attributes(note)) status = note.save ? 201 : 422 render json: note, status: status ...
class AddPrefecturesAddressCityAddressBuildingToOrder < ActiveRecord::Migration[5.1] def change add_column :orders, :prefectures, :integer add_column :orders, :address_city, :string add_column :orders, :address_building, :string end end
class Backend::BackendController < ApplicationController before_filter :require_login private def require_login unless session[:author_id] redirect_to new_login_path end end end
# frozen_string_literal: true require 'application_system_test_case' class CommentsTest < ApplicationSystemTestCase setup do @user = users :maymie end test 'comment flow' do log_in_as @user text = 'Happiness is when what you think, what you say, and what you do are in harmony.' within all('.com...
class Api::V1::BaseController < ActionController::API include Pundit # before_action :current_user after_action :verify_authorized, except: :index after_action :verify_policy_scoped, only: :index rescue_from StandardError, with: :internal_server_error rescue_from Pundit::NotAuthorizedError,...
require 'spec_helper' describe "module_of_disciplines/index.html.erb" do before(:each) do assign(:module_of_disciplines, [ stub_model(ModuleOfDiscipline), stub_model(ModuleOfDiscipline) ]) end it "renders a list of module_of_disciplines" do render end end
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" box = { :box => "ubuntu/trusty64", :hostname => "macdash-dev", :ram => 256 } Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = box[:box] config.vm.hostname = "%s" % box[:hostname] config.vm.provider "virtual...
# == Schema Information # # Table name: users # # id :integer not null, primary key # email :string default(""), not null # encrypted_password :string default(""), not null # reset_password_token :string # reset_password_sent_at :datetime # r...
class AdminMailer < ApplicationMailer def update_email(current_admin, edited_admin) @current_admin = current_admin @edited_admin = edited_admin mail(to: @edited_admin.email, subject: "Seus dados foram alterados") end end
require 'rails_helper' RSpec.describe Deployment, type: :model do describe 'associations' do it { is_expected.to belong_to(:app) } end describe 'validations' do it 'does not allow invalid image' do deployment = build_stubbed(:deployment, image: "ELF\x80\x20") expect(deployment).not_to be_val...
class Temperature def initialize(opts = {}) @ftemp = opts[:f] @ctemp = opts[:c] @ftemp = @ctemp * 1.8 + 32 unless @ctemp.nil? @ctemp = ((@ftemp - 32) / 1.8).round unless @ftemp.nil? end def in_fahrenheit @ftemp end def in_celsius @ctemp end def self.from_celsius(temp) self.new(:c => temp) end...
json.array!(@member_types) do |member_type| json.extract! member_type, :id, :name, :description json.url member_type_url(member_type, format: :json) end
# frozen_string_literal: true module Files class Certificate attr_reader :options, :attributes def initialize(attributes = {}, options = {}) @attributes = attributes || {} @options = options || {} end # int64 - Certificate ID def id @attributes[:id] end def id=(value)...
class Api::Picker::SessionsController < Api::PickerController skip_before_action :authenticate_user_from_token!, :require_picker!, only: [:create, :verify_otp] before_action :authenticate_user!, except: [:create, :verify_otp] def create @user = User.new user_params @user.inactive = true @user.role = ...
require '_spec_helper' describe "rotate words in an array by 13" do describe "#is_lowercase?" do it "returns true when a number is between 97 and 122" do lowerbound = 97 upperbound = 122 expect(is_lowercase?(lowerbound)).to eq(true) expect(is_lowercase?(upperbound)).to eq(true) end ...
class AddTccIdToUsers < ActiveRecord::Migration def change add_column :users, :tcc_id, :integer add_index :users, [:tcc_id] end end
class CreateLoans < ActiveRecord::Migration def change create_table :loans do |t| t.references :financing_plan, index: true, foreign_key: true, null: false t.integer :amount, null: false t.float :interest_rate_per_year, null: false t.integer :term_in_years, null: false t.timestamps ...
# web elements and functions for page class BookStorePage include Capybara::DSL include RSpec::Matchers include Capybara::RSpecMatchers def initialize @search_box = Element.new(:css, '#searchBox') @user_name_value = Element.new(:css, '#userName-value') @go_back_to_store_btn = Element.new(:css, '.t...
#======================================================================== # ** Crossfader, by: KilloZapit #------------------------------------------------------------------------ # Just a script to tweak the fades to use fancy crossfades like the # battle transition screens for all fades. By default this is made to us...
# ~*~ encoding: utf-8 ~*~ require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) context "Precious::Views::Editing" do include Rack::Test::Methods setup do @path = cloned_testpath('examples/revert.git') Precious::App.set(:gollum_path, @path) @wiki = Gollum::Wiki.new(@path) end te...
class AddMimesToFiles < ActiveRecord::Migration def change add_column :uploads, :mime_type , :string add_column :documents, :mime_type , :string add_column :aux_files, :mime_type , :string end end
class Url < ActiveRecord::Base before_save :validate_url def clicked! self.click_count += 1 self.save end def validate_url unless full_url.match(/http[s]{0,1}:\/\/.*/) self.full_url = "http://" + self.full_url end end end
class CreateCivilityVotes < ActiveRecord::Migration def change create_table :civility_votes do |t| t.integer :voter_id t.integer :debate_id t.integer :affirmative_id t.integer :negative_id t.integer :affirmative_rating t.integer :negative_rating t.timestamps null: false ...
# frozen_string_literal: true module Hyrax module CoreMetadata def self.included(work) work.property :depositor, predicate: ::RDF::URI.new('http://id.loc.gov/vocabulary/relators/dpt'), multiple: false work.property :title, predicate: ::RDF::Vocab::DC.title work.property :date_uploaded, predic...
module XCB class Reply::Geometry < FFI::Struct layout :response_type, :uint8, :depth, :uint8, :sequence, :uint16, :length, :uint32, :root, :window, :x, :int16, :y, :int16, :width, :uint16, :height, :uint16, :border_...
class Label < ActiveRecord::Base has_many :images, as: :imageable has_many :items end
describe Repositories::Workers::ScanRepository do describe '#perform' do subject(:worker_result) { described_class.new.perform(repository.id) } let(:repository) { create :repository_bitbucket } let(:failure) { false } let(:error) { nil } before do allow(Repository).to receive(:find).and_re...
class Datum < ActiveRecord::Base attr_accessible :book, :format, :name, :uncompressed_size @@mimetypes = { "CHM" => "application/vnd.ms-htmlhelp", "DJVU" => "image/vnd.djvu", "DOC" => "application/vnd.ms-word.document.macroenabled.12", "EPUB" => "application/epub+zip", "LIT" => "application/x-ms-reader", "MOBI" =>...
class Parameter < ActiveRecord::Base belongs_to :course belongs_to :college YEAR = (2009..Time.now.year) SEMESTER = { "1" => "Ganjil", "2" => "Genap" } def semester_nama SEMESTER[semester] end def self.semester_nama_options SEMESTER.to_a.sort end end
# frozen_string_literal: true # # Cookbook Name:: resource_container_host_linux # Recipe:: default # # Copyright 2017, P. van der Velde # # Always make sure that apt is up to date apt_update 'update' do action :update end # # Include the local recipes # include_recipe 'resource_container_host_li...
require 'spec_helper' require_relative "../../lib/models/reward_type.rb" RSpec.describe RewardType, type: :model do it "should be valid with the correct attributes" do expect(FactoryBot.build(:reward_type, :percent_off)).to be_valid end context "#name" do it "should be present" do expect(FactoryBo...
FactoryBot.define do factory :delivery do customer_id { 1 } name { Gimei.kanji } address { Gimei.address.kanji } postcode { Faker::Address.postcode } end end
module RailsMaps class Map def initialize(params) @name = params[:name] raise "Map needs a name attribute" unless @name params = {lat: 0, lon: 0, zoom: nil}.merge(params) @provider = "http://{s}.tile.osm.org/{z}/{x}/{y}.png" @attribution = '&copy; <a href="http://osm.org/copyright">...
# frozen_string_literal: true require './commands/recipes/list' RSpec.describe Commands::Recipes::List do let(:params) { instance_double(Sinatra::IndifferentHash) } let(:request) { instance_double(Sinatra::Request) } let(:command) { described_class.new(request, params) } let!(:recipe) do Recipe.create!( ...
# @param {String} s # @param {String} p # @return {Boolean} def is_match(s, p) match = %r(#{p}).match(s) return false if match.nil? match.to_s == s end
class RolesController < ApplicationController def self.document_params(required: false) param :name, String, desc: 'Name of the role', required: required param :description, String, desc: 'Description of the role', required: required param :permissions, Hash, desc: %(Hash of permissions allowed, such as {...
class PaymentSavingSerializer < ActiveModel::Serializer attributes :id, :booking_id, :payment_for, :amount, :status, :midtrans_id, :saving_type, :identity_id, :passport_id belongs_to :booking end
module ApplicationHelper def login_form_props {id: 'modal-login-form', title: 'Sign in', form: 'devise/sessions/form'} end def add_post_form_props {id: 'modal-add-post-form', title: 'Add post', form: 'posts/form'} end def login_modal_form form_data render 'shared/form_modal', props: login_form_...
# frozen-string-literal: true require File.join(File.dirname(__FILE__), 'helper') class AIFFExamples < Test::Unit::TestCase DATA_FILE_PREFIX = 'test/data/aiff-' context 'TagLib::RIFF::AIFF::File' do should 'Run TagLib::RIFF::AIFF::File examples' do # @example Reading the title title = TagLib::RIF...
class AddAccountToUsers < ActiveRecord::Migration def change add_column :users, :account, :string, :default => "member" end end
FactoryBot.define do factory :user do email { '01@test.com' } password { '123123123' } factory :faker do email { Faker::Internet.email } password { 'super-password' } end end factory :admin do email { Faker::Internet.email } password { 'super-password' } admin { true } ...
require 'net/http' require 'uri' require 'json' require 'yaml' require 'time' require 'date' require 'amazon-drs/deregistrate_device' require 'amazon-drs/subscription_info' require 'amazon-drs/replenish' require 'amazon-drs/error' require 'amazon-drs/slot_status' require 'amazon-drs/access_token' require 'amazon-drs/te...
require 'helper' class TestLazyTemplatetester < Test::Unit::TestCase context "The LazyTemplatetester" do setup do @template_checker = LazyTemplatetester.new end should "accept if mandatory key is there and value fits" do assert @template_checker.check_mustache("{{{mandatory}}}", { :...
puts 'Cadastrando as categorias..............' categories = [ "Animais e acessórios", "Esporte", "Para sua casa", "Eletrônico e celulares", "Músicas e hobbies", "Bebês e crianças", "Moda e beleza", "Veículos ...
# frozen_string_literal: true RSpec.describe GemfileNextAutoSync do subject do Bundler.with_original_env do `cd spec/fixtures && bundle install` end end let!(:original_gemfile) { File.read('spec/fixtures/Gemfile') } let!(:original_gemfile_next) { File.read('spec/fixtures/Gemfile') } let!(:origi...
require 'rails_helper' RSpec.describe 'Current Workout', js: true do let!(:gym) { create(:gym) } let!(:workout) { create(:workout, gym: gym) } let!(:exercise) { create(:exercise, workout: workout) } let!(:user) { create(:user, gym: gym, current_workout: workout.id) } before do sign_in user visit pro...
Pod::Spec.new do |s| s.name = 'BaseMVVM' s.version = '1.1.0' s.summary = 'My base MVVM Pod' s.description = <<-DESC Used for projects that applies MVVM architect DESC s.homepage = 'https://github.com/sonbt91/BaseMVVM' s.license =...
require_relative 'base' require_relative '../utils/file_path' require 'yaml' class IndexCommand < BaseCommand def initialize(options) super @template_path = @config["template_path"] if @template_path.relative_path? @template_path = File.join(@config["base_dir"], @template_path) end end def ...
class Reply < ActiveRecord::Base belongs_to :post belongs_to :user validates_presence_of :content def author user.email end def posted_on created_at.to_formatted_s(:long) end end
require 'spec_helper' describe PasswordResetService do let(:user) { FactoryGirl.create :user } let(:email_address) { user.primary_email_address } let(:service) { PasswordResetService.new email_address } # CLASS METHOD: active? describe ".active?" do subject { PasswordResetService.active? } conte...
@team_seeds = {} @message = "" def display_menu clear_menu if clear_menu == "yes" system "clear" end puts "**********************************************************" puts "**********************************************************" puts "****Welcome to my tournament generator. Enter a selection:" put...
class SalesController < ApplicationController def show @sale = Sale.find(params[:id]) @picture = @sale.pictures.first @category = @sale.category.name @url = @category + '/' + @picture.img end end
# Fibonnaci Sequence # Gabrielle Gustilo & Becca Nelson # Pseudocode: #INPUT: An integer #OUTPUT: True or false #STEPS: =begin DEFINE an array with two values - 0, 1 WHILE the last value of the array is =< the input variable equals the second to last array value plus the last array value ad...
require "cubing_average" require "comparable_solve" describe CubingAverage do it "saves singles" do singles = [stub, stub] CubingAverage.new(singles).singles.should == singles end it "accepts time as second attribute for .new, and caches it" do CubingAverage.new([stub], 40).time.should == 40 end ...
require File.dirname(__FILE__) + '/spec_helper' describe PrependFile do context "Dest File is a location" do before do @file_name = "sample_files/sample.txt" @original_contents = File.read(@file_name) end after do File.open(@file_name, 'w') {|f| f.write @original_contents} end ...
require_relative 'spec_helper' require 'pry' describe "Reservation" do describe "Initializes an instance of reservation and its instance methods" do before do @hotel_ada = Hotel::ReservationManager.new(20) @new_reservation = @hotel_ada.reserve_room("2018-08-23", "2018-08-25") @test_reservation = @hot...
require 'nokogiri' require 'terms' class CourseWorkCourses class Course attr_reader :title, :term, :cid, :cids, :sid, :instructors def initialize(title:, term:, cid:, cids:, sid:, instructors:) @title = title @term = term @cid = cid @cids = cids @sid = sid @instructors = i...
shared_examples 'request method' do let(:ssoid) { 'vnboeirubvyebvuekrybobvuiberlvbre' } let(:connection) { BetfairApiNgRails::Api::Connection.new } let(:http_response) { double(:http_response, code: '200', body: result_hash) } let(:result) { BetfairApiNgRails::Api::Http:...
# Read about factories at https://github.com/thoughtbot/factory_girl require 'random_helper' FactoryGirl.define do factory :shop do user { create(:shop_owner) } location published false logo "MyString" address1 { Faker::Address.street_address } address2 { RandomHelper.bi_rand Faker::Address.s...
require File.dirname(__FILE__) + "/test_helper" require 'fakeweb' require 'active_resource/find_as_hashes' module Resource class User < ActiveResource::Base self.site = 'http://api.test.com/' self.format = :json end end class ActiveResourceTest < ActiveSupport::TestCase def setup FakeWeb.allow_net_c...
module Concerns::Edu::SchoolAdmin extend ActiveSupport::Concern included do has_many :ugroups, class_name: "Edu::Ugroup", foreign_key: :school_id has_many :enrollments, class_name: "Acn::Enrollment", through: :ugroups has_many :users, through: :enrollments belongs_to :level, class_name: "Edu::Leve...
=begin #In-class printing exercises puts "Hey, I did a thing!" print('print: hello world ') puts('puts: hello world ') p('p: hello world ') =end # 1. Replace every even number with "Mined" def exercise1(max) even = false # Whichever number we pick we are starting at one. ...
# frozen_string_literal: true require "kafka/digest" module Kafka # Assigns partitions to messages. class Partitioner # @param hash_function [Symbol, nil] the algorithm used to compute a messages # destination partition. Default is :crc32 def initialize(hash_function: nil) @digest = Digest.fi...
require 'chemistry/element' Chemistry::Element.define "Sodium" do symbol "Na" atomic_number 11 atomic_weight 22.98976928 melting_point '371K' end
class CreateRepeats < ActiveRecord::Migration def change create_table :repeats do |t| t.string :repeat_type t.integer :repeat_daily_flag t.integer :repeat_weekly_flag t.integer :repeat_monthly_flag t.string :week_day t.string :monthly_day t.string :create_user t.dat...
class Rating < ActiveRecord::Base # mount_uploaders :image, RatingImageUploader belongs_to :user belongs_to :product validates :header, presence: true validates :review, presence: true validates :score, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 5 } end
class Experiment < ActiveRecord::Base attr_accessible :description, :name, :sample_ids has_and_belongs_to_many :samples accepts_nested_attributes_for :samples validates_presence_of :name end
require 'spec_helper' describe Chapter do before { @chapter = Chapter.new(title: "Example Chapter", number: 1, scene: "Acte 2", anecdote: "La dispute") } subject { @chapter } it { should respond_to(:title) } it { should respond_to(:number) } it { should respond_to(:scene) } it { should respond_to(:anecdo...
class ItemsController < ApplicationController def index @items = Item.order('slot').page(params[:page]).per(18) end def show @item = Item.find(params[:id]) end def category_index @items = Category.find(params[:id]).items.page(params[:page]) render action: :index end def new_items_index ...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'ultron/version' Gem::Specification.new do |spec| spec.name = 'ultron' spec.version = Ultron::VERSION spec.authors = ["Sérgio Rodrigues"] spec.email = ['sergio...