text
stringlengths
10
2.61M
class VotesController < ApplicationController before_action :authorized?, only: [:up, :down] def up get_vote if @current_vote @current_vote.destroy end @vote = Vote.create(post_id: params[:post_id], user_id: current_user.id, value: 1) redirect_to posts_path end def down get_vote ...
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Resources module Properties class PropertyImporter < Importer private def execute load.each_pair do |property_name, property_values| property_value...
require 'rails_helper' RSpec.describe NFL, type: :model do describe '#name_brief' do subject { @player.name_brief } context 'with first and last names' do before do @player = NFL.new first_name: 'Golden', last_name: 'Saltini' end it { is_expected.to eq 'G. Saltini' } end ...
#!/usr/bin/env ruby # Report the status of all Git repositories within a directory tree. require 'main' require 'git' $params = [] trap('INT') { exit 1 } module GitUpdate @sep_printed = false @last_empty = false def GitUpdate.separator if @sep_printed if not @last_empty print "\n" en...
$LOAD_PATH.unshift(File.dirname(__FILE__)) module VCAP module Services module Postgresql module WithWarden end end end end module VCAP::Services::Postgresql::WithWarden include VCAP::Services::Postgresql::Util include VCAP::Services::Base::Warden::NodeUtils def self.included(base) ...
Rails.application.routes.draw do root 'home#index' devise_for :users, path: '', path_names: { sign_in: 'login', sign_out: 'logout', edit: 'profile', sign_up: 'resgistration' }, controllers: { omniauth_callbacks: 'omniauth_callbacks' } mount Ckeditor::Engine => '/ckeditor' ...
class Admin::CategoriesController < Admin::AdminController before_action :require_admin before_action :load_category, except: %i(new create index) before_action :map_category, only: %i(create update) before_action :load_products_in_category, only: %i(show destroy) before_action :load_all_category, only: %i(ne...
require 'spec_helper' describe Breadcrumb do let(:crumb) {Breadcrumb.new} it 'can set a url' do crumb.url.should be_nil crumb.url = 'something' crumb.url.should == 'something' end it 'can set text' do crumb.text.should be_nil crumb.text = 'really long' crumb.text.should == 'really long...
class User < ApplicationRecord has_many :microposts validates :name,:email,presence:true end
# Preview all emails at http://localhost:3000/rails/mailers/admin_mail_mailer class AdminMailMailerPreview < ActionMailer::Preview # Preview this email at http://localhost:3000/rails/mailers/admin_mail_mailer/admin_email def admin_email AdminMailMailer.admin_email end end
class SaveCustomer prepend SimpleCommand attr_reader :args def initialize(args = {}) #@args = args @args = HashWithIndifferentAccess.new(args) # wrap with this so access by symbol and string works end def call if valid? save_record else nil end end private def save_...
require 'date' # # class String # def is_date? # temp=self.gsub(/[-.\/]/, '') # puts temp # puts temp.to_i # begin # if temp.to_i # ['%Y%m%d'].each do |f| # return true if Date.strptime(temp, f) # end # end # rescue # #do nothing # end # return fa...
class Dessert attr_accessor :name, :calories def initialize(name, calories) @name = name @calories = calories end def healthy? return true if @calories < 200 end def delicious? return true end end class JellyBean < Dessert def initialize(flavor) @name = flavor + " jelly bean" @calories...
class Api::V1::StudentGroupsController < Api::V1::ApiController # # Gets a list of student groups # # == Endpoint # # <code>GET /api/v1/student_groups</code> # def index render json: {student_groups: StudentGroup.order(:grade).as_json} end end
class Ingredient < ApplicationRecord has_many :additions has_many :recipes, through: :additions has_many :allergies has_many :users, through: :allergies validates :name, presence: true def allergy_count Allergy.where(ingredient_id: self.id).count end def self.ordered_by_users_...
class PagesController < ApplicationController def show render template: "pages/home" end end
require "./technology.rb" class Monitors < Technology attr_accessor :display_type attr_accessor :display_size attr_accessor :hdmi_count attr_accessor :dvi_count def initialize(voltage) @voltage = voltage end def configure(display_type, display_size, hdmi_count, dvi_count) @display_type = displa...
require 'rails_helper' describe EventsController do #let(:user) {User.create(username: "Bromance", password: "password")} before :each do user = User.new( username: "Bromano", password: "password1234", password_confirmation: "password1234" ) event = Event.new( name: "bypass...
require 'redmine' require_dependency 'improved_subtasks/patches/issue_patch' Redmine::Plugin.register :redmine_improved_subtasks do name 'Redmine Improved ParentTask behavior in subtasks structure' author 'Dariusz Kowalski' description 'This plugin change default behavior of priorities, start and due date at...
class Api::V2::ItemSerializer < ActiveModel::Serializer attributes :id, :name, :created_at, :complete, :completed_at has_one :user_id, :list_id end
class ArticlesController < ApplicationController before_action :set_article, only: [:show, :edit, :update, :destroy, :download_pdf, :fill, :add_image, :select_image, :add_personal_image, :add_quote] before_action :authenticate_user! # GET /articles # GET /articles.json def index @articles = Article.all ...
module Zulu class TopicDistribution LIST = "topic_distributions".freeze def self.push(distribution) Zulu.redis.lpush(LIST, distribution.to_json) end def self.pop(timeout=nil) _, options = Zulu.redis.brpop(LIST, timeout: timeout) options and new(Oj.load(options)) end ...
class NvsDeptProject < ActiveRecord::Base attr_accessible :internal_name, :name, :nvs_dept_id, :nvs_subsystem_id, :project_id validates :name, length: { maximum: 10, too_long: "%{count} characters is the maximum allowed" }, :presence => true validates :internal_name, length: { maximum: 5, too_long: "%{...
module Endpoints class Root < Base helpers do def heroku? session[:user_id] end def heroku_email user_get('email') end def dropbox? !user_get('dropbox_uid').nil? end def dropbox_name user_get('dropbox_name') end def app_name...
class Content < ActiveRecord::Base extend FriendlyId friendly_id :title, use: :slugged belongs_to :user has_many :sales has_attached_file :cover validates_attachment_content_type :cover, content_type: /\Aimage\/.*\z/, message: "Only image formats are supported" # has_attach...
module Api module V1 class ActivitiesController < ApplicationController before_action :set_activity, only: [:show, :update, :destroy] # GET /activities def index @activities = Activity.all json_response(@activities) end # POST /activities...
require "application_system_test_case" class MembershipsTest < ApplicationSystemTestCase test "Display sharing overview" do admin_go_to_agents_index first(".dropdown__trigger > button").click click_link "Share" within(".modal") do expected = [ "admin@viky.ai", "show_on_agent_...
class Error < ApplicationRecord belongs_to :search def self.report(params) return unless params[:message].present? or params[:text].present? @last_message = params[:message] Error.create(message: params[:message], text: params[:text], search_id: params[:search_id]) ErrorJob.perform_later(params...
use_file_names = true include_file_names = false loop do if ARGF.read(2) != "PK" if ARGF.eof? exit end warn "Input is not a zip file" exit 1 end if !(ARGF.read(2) == "\003\004") # file header exit end version = ARGF.read(2).unpack("v").first ...
module Users class RegistrationsController < Devise::RegistrationsController before_action :configure_sign_up_params, only: [:create] protected def configure_sign_up_params devise_parameter_sanitizer.permit(:sign_up, keys: %i[name surname]) end end end
class CreateRespuesta < ActiveRecord::Migration[5.0] def change create_table :respuestas do |t| t.string :contenido, null: false, default: '' t.references :comentario, null: false, default: '' t.timestamps null: false end end end
class SponsorsController < ApplicationController def new end def create @sponsor = Sponsor.new(sponsor_params) if @sponsor.save redirect_to new_sponsor_path flash[:success] = 'Enviado correctamente, te contactaremos pronto.' else flash.now[:error] = 'Por favor, revisa que todos lo...
source 'https://rubygems.org' ruby ENV['CUSTOM_RUBY_VERSION'] || '2.3.1' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use postgresql as the database for Active Record gem 'pg', '~> 0.18' # Use Puma as the app server gem 'puma', '~> 3.0' # Use SCSS for styleshe...
# Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path # Add Yarn node_modules ...
class Player < ActiveRecord::Base belongs_to :team belongs_to :position end
class Forum < ActiveRecord::Base validates_presence_of :subject validates_presence_of :message belongs_to :club, :counter_cache => true has_many :posts, :dependent => :delete_all end
class MyList < ApplicationRecord validates :movie_id, :profile_id, presence: true belongs_to :movie, foreign_key: :movie_id, class_name: :Movie belongs_to :user, foreign_key: :profile_id, class_name: :User end
class CreateBlogPostsBlogTags < ActiveRecord::Migration def change create_table :blog_posts_tags, id: false do |t| t.belongs_to :blog_post, index: true t.belongs_to :blog_tag, index: true end add_index :blog_posts_tags, [:blog_post_id, :blog_tag_id], unique: true add_index :blog_posts_tags...
class MigrateEmployeeDetailsToTable < ActiveRecord::Migration[5.0] def change Employee.all.each do |employee| employee.old_details.each do |field_name, detail_value| field = employee.company.fields.find_by(name: field_name) if field.present? && detail_value.present? employee.emplo...
FactoryGirl.define do sequence(:email) { |n| "person#{n}@example.com" } sequence(:name) { |n| "Name #{n}" } sequence(:id) { |n| "#{n}"*3 } sequence(:string) { |n| ('a'..'z').to_a.shuffle[0,8].join } factory :user do email { FactoryGirl.generate(:email) } password { FactoryGirl.generate(:string) } e...
#!/usr/bin/env ruby #coding: utf-8 require 'rubygems' require 'thor' require 'json' require_relative './image' require_relative './image_processor' # Process your images to CIFAR-10 binary # # [Usage] ./image_processor/processor.rb -s ./data/raw/google -o ./data/input -i 32 # class Processor < Thor default_command :...
module Accountable module Models def self.config(mod, *accessors) #:nodoc: class << mod; attr_accessor :available_configs; end mod.available_configs = accessors accessors.each do |accessor| mod.class_eval <<-METHOD, __FILE__, __LINE__ + 1 def #{accessor} if de...
require 'abstract_controller' require 'cell/builder' require 'cell/caching' require 'cell/rendering' require 'cell/dsl' module Cell require 'uber/version' def self.rails_version Uber::Version.new(::ActionPack::VERSION::STRING) end class Base < AbstractController::Base # TODO: deprecate Base in favour...
class CreateWeekdays < ActiveRecord::Migration def change create_table :weekdays do |t| t.string :name t.string :acronym t.integer :value t.timestamps null: false end Weekday.create([ {name: 'Domingo', acronym: "D", value: 0}, {name: 'Segunda', acronym: "S", value: 1}, {name: 'Terça', acro...
require 'rubygems' require 'rack' require 'yaml' require File.dirname(__FILE__) + '/middleware' module ItsyBitsy def self.build &block app = App.new app.instance_eval &block app end class App def initialize @simple_cache = {} @slugs = {} @routes = { :get => {}, :post => {}, :...
# question 3 advice = "Few things in life are as important as house training your pet dinosaur." advice.gsub! "important", 'urgent' puts advice # question 4 numbers = [1, 2, 3, 4, 5] numbers.delete_at(1) # => 2 This method deletes the element with index == 1. numbers is now: [1, 3, 4, 5] numbers = [1, 2, 3, 4, 5...
class Staff::StaffController < ApplicationController before_action :authenticate_admin! layout 'staff/layouts/staff_layout' def show @dashboard = nil end end
class User < ActiveRecord::Base has_many :posts has_many :comments validates_presence_of :name, :email, :password end
class Users::CertificatesController < ApplicationController ssl_required :show, :update before_filter :authenticate_user! before_filter :load_merchant_or_redirect before_filter :build_certificate_action_filter before_filter :load_certificates layout 'bootstrap/users' def show end def update ...
# frozen_string_literal: true require 'rails_helper' module Facilities RSpec.describe VHAFacility do before(:each) { BaseFacility.validate_on_load = false } after(:each) { BaseFacility.validate_on_load = true } it 'should be a VHAFacility object' do expect(described_class.new).to be_a(VHAFacility) ...
Rails.application.routes.draw do get 'pages/home' get 'pages/my_todo_items' resources :flats do resources :utilities resources :accounts end # root 'tariffs#index' # logged_in_user do root "pages#my_todo_items" # get '/*path' => 'pages#my_todo_items' # end # root 'categories#index' # get...
# # dialog_list_snapshots.rb # Description: Retrieve a list of available snapshots for the selected VM # To be used in a dynamic dropdown list # require 'rest-client' require 'json' require 'openssl' def call_rhevm(ext_mgt_system, uri, type=:get, payload=nil) params = { :method => type, :url => "https://#{...
class Product < ApplicationRecord belongs_to :seller has_many :buyers, through: :ratings end
class Project < ActiveRecord::Base include FakeDestroy resourcify validates :name, presence: true has_many :stories, dependent: :destroy has_many :story_tags, through: 'Story' has_many :story_types, through: 'Story' has_many :tasks, through: 'Story' has_many :feedbacks end
require 'spec_helper' describe Book do it "should be invalid without name" do book = Book.new book.author_names = 'Test Test' book.should_not be_valid book.errors[:name][0].should == "can't be blank" book.name = 'Test1' book.should be_valid end it "should be invalid without author names" do bo...
class ChangeSwipeHubToHub < ActiveRecord::Migration def up rename_column :swipes, :swipe_hub_id, :hub_id create_table :hubs do |t| t.integer "organization_id" t.string "location" t.integer "sign_in_count", :default => 0 t.datetime "current_sign_in_at" t.datetime "last...
require 'uri' Puppet::Type.newtype(:nexus_repository_target) do @doc = "Manages Nexus Repository Target through a REST API" ensurable newparam(:name, :namevar => true) do desc 'Unique Repository Target identifier; once created cannot be changed unless the Repository Target is destroyed. The Nexus UI will n...
class Create<%= plural_name.camelize %> < ActiveRecord::Migration def self.up create_table :<%= plural_name %> do |t| t.string :address, :null => false t.integer :parent_id t.integer :position t.boolean :published, :default => true t.text :html_options t.string :wclass ...
# encoding: utf-8 class Xi::DIP::Color::Hex def self.validate(color) raise Xi::DIP::Error::ConfigError, \ "Bad input: #{color}. Expected String(7)" \ unless color.is_a?(String) && color.size == 7 && color.start_with?('#') end def self.to_pixel(color) ncolor = color.delete('#').scan(/../) ...
FactoryBot.define do factory :buyer_detail, class: FacilitiesManagement::BuyerDetail do full_name { 'MyString' } job_title { 'MyString' } telephone_number { '07500404040' } organisation_name { 'MyString' } organisation_address_line_1 { 'MyString' } organisation_address_line_2 { 'MyString' } ...
require 'spec_helper' require 'dvorak/cli' module Dvorak describe 'CLI' do describe 'new' do it 'creates a directory with the same name as the game' do cli = Dvorak::CLI.new expect(cli).to receive(:directory).with(:game, 'mad_world') cli.new('mad_world') end end descr...
class Currency attr_reader :currency_code, :amount def initialize(currency_code, amount) @currency_symbols = {"$" => :USD, "€" => :Eur, "¥" => :JPY} if currency_code.class == String @currency_code = @currency_symbols[currency_code[0]] @amount = currency_code.gsub(currency_code[0], "").to_f...
class MenuItem < ActiveRecord::Base belongs_to :menu_item_type #fk delegate :restaurant, to: :menu_item_type end
class ManufacturersController < ApplicationController def new @manufacturer = Manufacturer.new end def create @manufacturer = Manufacturer.new(manufact_params) if @manufacturer.save redirect_to new_manufacturer_path, notice: "Manufacturer is recorded!" else render 'new' end en...
require './lib/pieces/pieces.rb' RSpec.describe Knight do describe '#impossible_move?' do def moves(row, col) [[2, -1], [2, 1], [-2, -1], [-2, 1], [-1, 2], [1, 2], [-1, -2], [1, -2]].select do |i, j| (row + i).between?(0, 7) && (col + j).between?(0, 7) end.map { |i, j| [row + i, col + ...
# This controller provides a frontend for users to edit their data. # Currently, only "change password" has been implemented. class ActiveRbac::MyAccountController < ActiveRbac::ComponentController # Allows the user to change his password. If the user is in the # "retrieved_password" state then the view will di...
# encoding: UTF-8 module CDI module V1 module GameQuestionOptions class BatchCreateService < BaseActionService action_name :batch_game_question_options_create OPTION_VALID_KEYS = [:text, :correct].sort.freeze WHITELIST_ATTRIBUTES = [ :text, :description, ...
class DadosDn4 < ActiveRecord::Base belongs_to :laudo validates :queimadura, :inclusion => { :in => [true, false]} validates :frio_doloroso, :inclusion => { :in => [true, false]} validates :choques_eletricos, :inclusion => { :in => [true, false]} validates :formigueiro, :incl...
class Contact attr_accessor :first_name, :middle_name, :last_name def initialize(first_name, middle_name, last_name) @first_name = first_name @middle_name = middle_name @last_name = last_name end end anakin = Contact.new('Anakin', "d.", 'Skywalker') pp anakin
module Roglew module GL CURRENT_VERTEX_EXT ||= 0x87E2 FULL_RANGE_EXT ||= 0x87E1 INVARIANT_DATATYPE_EXT ||= 0x87EB INVARIANT_EXT ||= 0x87C2 INVARIANT_VALUE_EXT ...
class NutritionOnlyController < ApplicationController skip_before_action :authenticate_user! layout 'nutrition_only' def index @gyms = Gym.all.includes(:users) @gym = Gym.find_by(subdomain: params[:gym]) @user = User.new end def create @user = User.new(user_params) @user.not_a_robot = true...
class AddResponseToUsers < ActiveRecord::Migration def change rename_column :users, :message, :message_address add_column :users, :presence, :string add_column :users, :message_response, :string end end
module TheSortableTree module Backends # @see https://github.com/stefankroes/ancestry/wiki/Integrating-with-acts_as_list module AncestryActsAsList def self.included(base) # :nodoc: base.class_eval do # @todo get from #position_column self.the_sortable_tree_sort_order = 'ance...
require 'set' # require 'pp' require 'pry' require_relative 'day13' class Maze attr_accessor :grid, :targets, :distances def initialize input @targets = find_targets input @grid = input @distances = find_distances end def open? coords x, y = coords grid[x][y] != '#' end def shortest_...
try_require "mini_magick" do args = %W(resize quality rotate crop flip @2x @4x @half) Jekyll::Assets::Env.liquid_proxies.add :magick, :img, *args do class DoubleResizeError < RuntimeError def initialize "Both resize and @*x provided, this is not supported." end end # ---------------...
class Pattern < ActiveRecord::Base belongs_to :user has_many :comments has_many :favorite_patterns, dependent: :destroy has_many :favorited_by, through: :favorite_patterns, source: :user validates_presence_of :name, :content, :materials, :needles, :yarn, :weight, :quantity def favo...
# Problem 255: Rounded Square Roots # http://projecteuler.net/problem=255 # We define the rounded-square-root of a positive integer n as the square root of n rounded to the nearest integer. # # The following procedure (essentially Heron's method adapted to integer arithmetic) finds the rounded-square-root of n: # Let...
module Kaya module Results def self.all_results_for suite_id Kaya::Database::MongoConnector.results_for suite_id end def self.results_ids_for suite_id all_results_for(suite_id).map do |result| result["_id"] end end def self.all_results_ids Kaya::Database::MongoCo...
class LikesController < ApplicationController def create like = current_user.likes.build(tweet_id: params[:tweet_id]) if like.save redirect_to tweet_path(id: params[:tweet_id]), notice: "You liked this Tweet!" else redirect_to tweets_path, notice: "You could not like ...
require 'logger' module Parser def self.parse command, board logger = Logger.new $stdout logger.level = Logger::INFO logger.info "received command: #{command}" board.commands.append(command) tokens = command.split head = tokens.shift begin case head when 'add' parse_ad...
require 'shoulda-matchers' require 'rack/test' require 'database_cleaner/active_record' require 'factory_bot' require 'webmock/rspec' require 'pry-byebug' require_relative '../boot' require_relative 'controllers/application_spec' require_all 'spec/contexts/*.rb' module Helpers def parsed_body(symbolize: false) ...
class AddSectionIdToTimeSlot < ActiveRecord::Migration def change rename_table :time_slots, :time_slot add_column :time_slot, :section_id, :integer end end
class AddLanguageToCodebooks < ActiveRecord::Migration def change add_column :codebooks, :language, :integer end end
# -*- encoding: utf-8 -*- require File.expand_path('../lib/chronos/version', __FILE__) Gem::Specification.new do |gem| gem.name = "chronos-api" gem.version = Chronos::VERSION gem.authors = ["Algolia Team"] gem.email = %w{support@algolia.com} gem.description = %q{A simple REST c...
require "spec_helper" describe('the listing venues path', {:type => :feature}) do it('adds a list of venues') do venue = Venue.create({name: "artichoke"}) visit('/venues') expect(page).to have_content(venue.name) end end describe('the adding venues path', {:type => :feature}) do it('adds a venue') ...
class StaffsController < ApplicationController before_action :authenticate_user! def index load_staffs end def new build_staff end def edit load_staff build_staff end def create build_staff save_staff or render(:new) end def update load_staff build_staff save...
#encoding: utf-8 require 'spec_helper' describe "User pages" do subject { page } describe "index" do let(:user) { FactoryGirl.create(:user) } before(:each) do sign_in user visit users_path end it { should have_title('Membres NQA') } it { should have_content('Membres NQA') }...
class GenresController < ApplicationController def index @genres = Genre.all.sort{|a,b| a.name.to_s.downcase <=> b.name.to_s.downcase} respond_to do |format| format.html # index.html.erb format.xml { render :xml => @genres } end end end
class Array # ['a', 'b'].extract_if_singleton => ['a', 'b'] # ['b'].extract_if_singleton => 'b' def extract_if_singleton (length==1) ? first : self end end class Hash def safe_merge(new_hash) self.merge(new_hash){|key,old,new| if new.nil? || (new.respond_to?(:empty?) && new.empty?) ...
class RemoveAreaFromPosts < ActiveRecord::Migration[5.2] def change remove_column :posts, :area, :integer end end
module Topographer class Importer class Mapper module MappingValidator def validate_unique_validation_name(name) raise Topographer::InvalidMappingError, "A validation already exists with the name `#{name}`" if validation_mappings.has_key?(name) end def validate_unique_out...
shared_context 'all Trade Events fixture data' do include_context 'TradeEvent::Dl data' include_context 'TradeEvent::Exim data' include_context 'TradeEvent::Ita data' include_context 'TradeEvent::Sba data' include_context 'TradeEvent::Ustda data' end shared_context 'all Trade Events v2 fixture data' do inc...
class AddGravatarToNurses < ActiveRecord::Migration[5.1] def change add_column :employee_records, :gravatar, :string change_column_default :employee_records, :gravatar, from: nil, to: "https://www.gravatar.com/avatar/d69ab4fb9bb28c0527e972273614f585" end end
# # Tests spéciaux de la class Question # require 'spec_helper' describe Comment do before(:all) do Site::init end it "doit répondre à :link_new" do Comment.should respond_to :link_new end it ":link_new doit renvoyer un lien correct" do data = {:thing_id => "pourvoir", :ce_parent => "ce lien test"} ...
# Your code goes here! require 'pry' class Anagram attr_accessor :words def initialize(words) @words = words end def match(other_words) anagram = [] other_words.each do |word| if word.split(//).sort == @words.split(//).sort anagram << word end end anagram end end
class AddingExtraValuestoRestaurants < ActiveRecord::Migration[5.0] def change add_column :restaurants, :neighborhood, :string add_column :restaurants, :price_range, :string add_column :restaurants, :summary, :text_field end end
require "fog/core/collection" require "fog/brkt/models/compute/zone" module Fog module Compute class Brkt class Zones < Fog::Collection model Fog::Compute::Brkt::Zone # @return [Network] attr_accessor :network # Get network zones. # If {#network} attribute is set, ...
class Api::V1::OrganizationsController < ApiController def index @organizations = Organization.all respond_to do |format| format.json { render json: @organizations } end end def show @organization = Organization.find_by(id: params[:id]) respond_to do |format| format.json { render ...
class RemoveSupervisorIdFromGoals < ActiveRecord::Migration def change remove_index :goals, :supervisor_id remove_column :goals, :supervisor_id end end
class ProjectScore < ActiveRecord::Base attr_accessible :point, :description, :weight validates :point, :presence => true validates :description, :presence => true validates :weight, :presence => true, :numericality => { :only_integer => true } validates :project_id, :presence => true, :numericality ...