text
stringlengths
10
2.61M
require 'rails_helper' RSpec.feature "UserCanMarkLinkAsUnreads", type: :feature do it "can mark a link as unread", js: true do user = create(:user_with_read_link) ApplicationController.any_instance.stubs(:current_user).returns(user) link = user.links.first visit '/' within("#link-#{link.id}") d...
class Testimonial < ActiveRecord::Base belongs_to :user validates_presence_of :body validates_presence_of :client validates_presence_of :user_id def preview if self.body.size < 300 self.body else self.body.first(300) + " ..." end end end
class Download < ActiveRecord::Base belongs_to :download_folder validates_presence_of :name, :download_folder_id, :url validates_numericality_of :download_folder_id validates_uniqueness_of :name attr_protected :id, :download_folder_id, :created_at, ...
# frozen_string_literal: true require "spec_helper" describe "Follow opinions", type: :system do let(:manifest_name) { "opinions" } let!(:followable) do create(:opinion, component: component) end include_examples "follows" end
module FishTank class Tank attr_accessor :taxa def initialize @taxa = [] end def add(taxon) @taxa.push(taxon) end end end
require 'rails_helper' describe SessionsController do describe "POST create" do context 'when password is invalid' do it 'renders the page with error' do @request.env["devise.mapping"] = Devise.mappings[:user] user = create(:user) post :create, session: { email: user.email, passw...
require_relative "piece" require_relative "SlidingPiece" class Rook < Piece include SlidingPiece def initialize(board, position, color) super(board, position, color) @horizontal = true @diagonal = false end def symbol color == :white ? "\u2656" : "\u265C" end def valid_moves all_mov...
class CreateCategory class Result < Struct.new(:success, :category) def success? success == true end end def initialize(attributes:) @attributes = attributes end def call return Result.new false if Category.find_by(name: @attributes[:name]) category = Category.new(@attributes) ...
require 'json' class Parser def parse_test_result(results_obtained) clean_output = clean_empty_lines(results_obtained) hash_results = test_results_to_hash(clean_output) remaining = remove_unnecessary_symbols(hash_results) csv_headers.zip(remaining).to_h.reduce(Hash.new(0)) do |h, (k,v)| h[k] =...
class GroupSerializer < ActiveModel::Serializer attributes :id, :name has_many :users, :serializer => UserGroupSerializer end
module Mutant class Matcher # Matcher for subjects that are a specific method class Method < self include Adamantium::Flat, Concord::Public.new(:env, :scope, :target_method) include AST::NodePredicates # Methods within rbx kernel directory are precompiled and their source # cannot be ...
ActiveAdmin.register Dealer do batch_action :destroy, false filter :name filter :lastname filter :shopname filter :email filter :created_at actions :all, :except => [:new,:edit, :destroy] index do selectable_column column :name column :lastname column :shopname column :email actions end form do...
module Sheets module Parseable include Enumerable def self.included(base) base.extend(ClassMethods) end module ClassMethods def parseable_formats Sheets::Utilities.subclasses_in(Sheets::Parsers).map(&:formats).flatten.uniq end end def each to_array.each {|row...
require 'byebug' class TagTopic < ActiveRecord::Base has_many :taggings, primary_key: :key, foreign_key: :tag_id, class_name: "Tagging" has_many :sites, through: :taggings, source: :shortened_url def most_visited most_visited_count = 0 most_visited_site = nil tags = Tagging.where...
class CreateSettings < ActiveRecord::Migration def change create_table :settings do |t| t.string :nama_aplikasi t.string :email_default t.text :alamat t.string :default_password t.boolean :zopim t.boolean :site_status t.timestamps null: false end end end
require 'geo_caches_serializer' class GeoCacheBroadcastJob < ApplicationJob queue_as :default def perform id geo_cache = GeoCache.find(id) geo_cache_serialized = GeoCachesSerializer.new(geo_cache).as_json ActionCable.server.broadcast('geo_cache_channel', geo_cache_serialized) end end
require_relative '../src/position' describe 'Position' do before(:each) do @position = Position.new(2,3) end it 'should return postion x is 2 when given to [2,3]' do expect(@position.x).to eq(2) end it 'should return postion y is 3 when given to [2,3]' do expect(@position.y).to eq(3) end d...
require_relative 'response' require_relative 'guess_checker' class Mastermind attr_reader :correct_color_count, :correct_position_count, :generated_sequence attr_accessor :guess def initialize @colors = ['r','g','b','y'] @generated_sequence = nil end ...
require 'pry' class Zoo # A zoo should be initialized with a name and a location, which should both be passed as strings. # Zoo#location should return the location of the zoo instance. # Zoo#name should return the name of the zoo instance. attr_accessor :name, :location, :animals @@all = [] def initialize(zoo_n...
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "grape_goliath" s.version = "0.0.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["manishaharidas"] s.date = "2013-09-23" s.description = "grape_goliath is a gem which cr...
class AddSpecificCommentsToReviews < ActiveRecord::Migration def change change_table :reviews do |t| # specific comments t.text :course_comment t.text :prof_comment t.text :workload_comment # add workload_rating t.integer :workload_rating # remove old one-size-fits-all ...
class DeleteTableImage < ActiveRecord::Migration[6.1] def change drop_table :images_old end end
require_relative '../spec_helper' describe 'frog::_mysql' do context 'no dbms install' do cached(:chef_run) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |node| node.set['frog']['db']['install_dbms'] = false end.converge(described_recipe) end it 'should not att...
module Tablette class Column < Element config.tag = 'td' def initialize(*args, &block) self.value = block self.key = args.first if args.first.is_a?(String) or args.first.is_a?(Symbol) config.builtin_html_options = ->(member, index = nil) do classes = [] if self.key.prese...
# Gitlab::Git::Commit is a wrapper around native Grit::Commit object # We dont want to use grit objects inside app/ # It helps us easily migrate to rugged in future module Gitlab module Git class Commit attr_accessor :raw_commit, :head, :refs SERIALIZE_KEYS = [ :id, :message, :parent_ids, ...
class CreateParts < ActiveRecord::Migration def change create_table :parts do |t| t.string :part_code t.string :name t.string :part_no t.string :nscm t.integer :manufacturer_id t.integer :location_id t.string :tool_klass t.integer :packing_quantity t.string :p...
require 'spec_helper' describe NineOneOne do it 'has a version number' do expect(NineOneOne::VERSION).not_to be nil end describe 'configuration' do it 'accepts "send_pagers" param' do NineOneOne.configure do |config| config.send_pagers = true config.pager_duty_integration_key = 'ke...
class FormsController < ApplicationController after_action :verify_authorized def new authorize @company = Company.find(company_params) @form = @company.forms.new(form_params) end def create authorize @company = Company.find(company_params) # Change choices attributes from string to array ...
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception before_filter :set_locale def set_locale I18n.locale=params[:locale] end rescue_from CanCan::AccessDenied ...
require 'hand' require 'card' class Player attr_reader :hand, :name attr_accessor :pot def initialize(name) @hand = Hand.new @pot = 0 @name = name end def cards_to_discard selected_cards = [] puts "Enter cards that you would like to discard one by one." print " >" begin sel...
# Copyright:: Copyright (c) 2017 eGlobalTech, Inc., all rights reserved # # Licensed under the BSD-3 license (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License in the root of the project or at # # http://egt-labs.com/mu/LICENSE.html # # Unless ...
# frozen_string_literal: true class ApplicationController < ActionController::Base before_action :authenticate_user! before_action :configure_permitted_parameters, if: :devise_controller? protected def configure_permitted_parameters devise_parameter_sanitizer.permit(:sign_up, keys: %i[email name password...
require 'spec_helper' describe 'Fastladder::Crawler' do let(:crawler) { Fastladder::Crawler.new(Rails.logger) } let(:feed) { FactoryBot.create(:feed) } context 'when some items have same guid' do let(:items) { FactoryBot.build_list(:item_has_fixed_guid, 2) } describe '#reject_duplicated' do it 't...
require 'spec_helper' RSpec.describe BooksController, :type => :controller do let!(:book) { FactoryGirl.create :book } let!(:new_book) { FactoryGirl.build :book } describe 'POST #create' do context 'when name is empty' do it "is status is 422" do post :create, :book => {'name' => '', 'des...
require './converter.rb' require './tax_calculator.rb' require './round_off.rb' class Item include Converter, TaxCalculator, RoundOff def self.get_name(product, imported) if imported item = product.split()[2] else item = product.split()[1] end end def self.isImported(product) prod...
require 'spec_helper' describe DuoApi do it 'has a version number' do expect(DuoApi::VERSION).not_to be nil end it "configs" do DuoApi.config do |config| config.app_secret = "abc" end expect(DuoApi.config.app_secret).to eq("abc") end it "sends GET to Request" do expect(DuoApi::Re...
module ApplicationHelper def format_date time time.strftime("%B %e, %Y") end def format_time_range_short start_time, end_time [format_time_short(start_time), format_time_short(end_time)].join(' - ') end def format_time_short time time.strftime("%-l:%M%P") end def header_menu_items @head...
require 'spec_helper' describe Stormpath::Resource::Organization, :vcr do let(:organization) do test_api_client.organizations.create name: 'test_organization', name_key: "testorganization", description: 'test organization' end after do organization.delete if organization end def create_orga...
require 'msf/core' require 'msf/base/xssf' # # READ README_XSSF FILE FOR MORE INFORMATION ABOUT MODULES # class Metasploit3 < Msf::Auxiliary include Msf::Xssf::XssfServer # Module initialization def initialize(info = {}) super(update_info(info, 'Name' => 'PROMPT XSSF', 'Description' => 'Simple XSSF...
# frozen_string_literal: true require 'cgi' require 'uri' require 'open3' require 'fileutils' require 'tmpdir' module QA module Git class Repository include Scenario::Actable attr_writer :password attr_accessor :env_vars def initialize # We set HOME to the current working direc...
Gem::Specification.new do |spec| spec.name = "embulk-input-youtube-reporting" spec.version = "0.1.0" spec.authors = ["Angelos Alexopoulos"] spec.summary = "Youtube Reporting input plugin for Embulk" spec.description = "Loads records from Youtube Reporting." spec.email =...
require_relative("../db/sql_runner") require('pry') class Book attr_accessor :id, :title, :composer, :description, :stock_quantity, :buying_cost, :selling_price, :publisher_id def initialize(options) @id = options['id'].to_i if options['id'] @title = options['title'] @composer = options['composer'] ...
require('minitest/autorun') require('minitest/rg') require_relative('../sports_team.rb') class TestTeam < MiniTest::Test @team def setup @team = Team.new("Manchester United", ["David", "Jim"], "Alex Ferg", 0) end # def test_team_name # assert_equal("Manchester United", @team.team_name) # end # # def...
class Post < ActiveRecord::Base # nice slugs from post title extend FriendlyId friendly_id :title, use: [:slugged, :finders] # we belong to user and are treated as an object of a tenant belongs_to :user acts_as_tenant(:user) has_many :post_category_joinings has_many :post_categories, through: :post_ca...
class Row def display_transaction(transaction) "#{date(transaction)} || #{credit(transaction)} || #{debit(transaction)} || #{balance(transaction)}" end private def date(transaction) transaction.date end def credit(transaction) return_float(transaction.credit) if transaction.credit end de...
class Transaction < ActiveRecord::Base belongs_to :credit_account, class_name: 'Account', foreign_key: :credit_id belongs_to :debit_account, class_name: 'Account', foreign_key: :debit_id has_one :bank_reconciliation end
class PgbouncerHelper attr_reader :node def initialize(node) @node = node end def database_config(database) settings = node['gitlab']['pgbouncer']['databases'][database].to_hash # The recipe uses user and passowrd for the auth_user option and the pg_auth file settings['auth_user'] = settings.d...
if Rails.env.development? puts "Destroying tags..." Tag.destroy_all puts "Destroying plants..." Plant.destroy_all puts "Destroying gardens..." Garden.destroy_all end puts "Creating gardens..." g = Garden.create!( name: "My Little Garden", banner_url: "https://raw.githubusercontent.com/lewagon/fullstack-i...
class Story < ActiveRecord::Base has_many :pages has_attached_file :cover, styles: Artwork::STYLES validates_attachment_content_type :cover, content_type: /\Aimage\/.*\Z/ end
class StockTransController < ApplicationController before_action :set_stock_tran, only: [:show, :edit, :update, :destroy] # GET /stock_trans # GET /stock_trans.json def index @stock_trans = StockTran.all end # GET /stock_trans/1 # GET /stock_trans/1.json def show end # GET /stock_trans/new ...
#!/usr/bin/env ruby require 'active_record' require 'active_record/base' require 'colorize' require 'rake' require 'thor' require_relative './lib/models/checkout.rb' class Supermarket < Thor db = YAML.load(File.read("#{Dir.pwd}/db/config.yml"))["development"] ActiveRecord::Base.establish_connection(db) TMP_DATA...
require_relative "distance_calculator" class FindCustomers def initialize(locations, within_radius, home_latitude, home_longitude) @locations = locations @within_radius = within_radius @home_latitude = home_latitude @home_longitude = home_longitude end #retrieves customers within the given radiu...
require 'spec_helper' describe Types::Clickable do include_context :types before do element.extend(Types::Clickable) element_with_hooks.extend(Types::Clickable) end describe 'click' do it 'can click the browser element' do element.browser_element.should_receive(:click) element.click ...
desc 'Update tweets from Twitter' task :update_tweets => :environment do require 'rubygems' gem 'twitter' require 'twitter' max_tweets = 5 Contact.find(:all).each do |c| #get last 5 tweets: if c.twitter_name && c.twitter_n...
class CreateYoutubeData < ActiveRecord::Migration def change create_table :youtube_data do |t| t.integer :client_id t.date :start_date t.date :end_date t.integer :social_network_id t.integer :new_subscriber t.integer :total_subscriber t.integer :total_video_views t....
class Api::Contents::ContentsController < ApplicationApiController def index pag = params[:page] ? params[:page] : 1 limit = params[:limit] ? params[:limit] : 99999 subcategory_id = params[:subcategory_id] ? params[:subcategory_id] : nil conte...
require 'spec_helper' describe RunPal::GetUser do before :each do RunPal.db.clear_everything end it 'gets a user' do user = RunPal.db.create_user({first_name:"Isaac", gender: 2, email: "gravity@apple.com", bday: "03/14/1945"}) result = subject.run({user_id: user.id}) expect(result.success?).to...
require 'pry' require 'minitest/autorun' require_relative 'weather' class WeatherTest < Minitest::Test Minitest.after_run do if File.file? 'test.csv' File.delete 'test.csv' end end describe "weather" do before do @weather = Weather.new end # this is not a great test it "wil...
class JobLog < ActiveRecord::Base include ExtJS::Model include DurationDisplay extjs_fields :id, :job_name , :job_class_name, :user_id , :duration_display, :success,:user_email, :stopped_at, :estimation_error_seconds cattr_reader :per_page @@per_page = 25 belongs_to :user belongs_to :project after...
class CreateMushroomFeatures < ActiveRecord::Migration[5.1] def change create_table :mushroom_features do |t| t.string :name t.string :scientific_name t.string :color t.text :description t.string :shape t.integer :size_min t.integer :size_max t.boolean :poisonous ...
# frozen_string_literal: true require 'page-object' class RepositoryPage include PageObject text_field(:repository_url, id: 'empty-setup-clone-url') buttons(:list_subcription_button, name: 'do') def list_subcription find_element(xpath: "//notifications-list-subscription-form[@class = 'f5 position-relativ...
require 'hashie' require 'open-uri' require 'timeout' require 'uri' require 'irobot/logger' require 'irobot/response' require 'irobot/response/robots_allow' module Irobot class Request include Logger include Response::RobotsAllow def self.allowed?(uri, user_agent) new(uri, user_agent).allowed? ...
module ApplicationHelper # TODO: refactor def current_user_link(html_options = {}) user_link current_user, html_options end def user_link(user, html_options = {}, &block) link_to user.to_s, user, html_options, &block end def destroy_button(body, url, confirm_message = 'Are you sure?', args = {}) ...
#!/usr/bin/env ruby # # Gestion de cours et de programme d'etudes. # require 'fileutils' require_relative 'cours' require_relative 'cours-texte' require_relative 'motifs' ################################################### # CONSTANTES GLOBALES. ################################################### # Nom de fichier p...
class Phone < ActiveRecord::Base belongs_to :institution belongs_to :contact validates_size_of :number, :minimum => 12 TYPES_FOR_INSTITUTION = [['Comercial', 1], ['Celular', 2], ['Fax', 4]] TYPES_FOR_CONTACT = [['Residencial', 3],['Comercial', 1], ['Celular', 2]] end
class Category < ApplicationRecord has_many :gigs has_many :requests end
class AddAttrToPictures < ActiveRecord::Migration[5.1] def change add_column :pictures , :name , :string add_column :pictures , :sex , :string end end
class Movie < ApplicationRecord validates :title, :description, :rating, :year, :duration, presence: true has_many :movies_genre, foreign_key: :movie_id, class_name: :MoviesGenre has_many :lists, foreign_key: :movie_id, class_name: :MyList has_one_attached :image...
# encoding: UTF-8 module CDI module V1 module LearningTracks class LearningDynamicCreateService < LearningDynamics::CreateService include V1::ServiceConcerns::LearningDynamicParams record_type ::LearningDynamic private def can_create_record? return false unless ...
require 'rails_helper' RSpec.describe "story_subcategories/index", type: :view do before(:each) do assign(:story_subcategories, [ StorySubcategory.create!( :name => "Name", :code => "Code", :story_category => nil ), StorySubcategory.create!( :name => "Name", ...
# frozen_string_literal: true require_relative "changelog" class Release module GithubAPI def gh_client @gh_client ||= begin require "octokit" Octokit::Client.new(:access_token => ENV["GITHUB_RELEASE_PAT"]) end end end module SubRelease include GithubAPI attr_reader...
# spec/parsers/simple_parser_spec.rb require 'spec_helper' require 'parsers/abstract_parser_helper' require 'controllers/mixins/actions_base' require 'parsers/simple_parser' describe Mithril::Parsers::SimpleParser do let :actions do klass = Class.new klass.extend Mithril::Controllers::Mixins::ActionMixin ...
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html Rails.application.routes.draw do namespace :api do namespace :v1 do resources :tasks, only: %i[index destroy update create] do post :destroy_completed, on: :collection put :batch_update_statu...
class Species < ActiveRecord::Base belongs_to :family, class_name: 'Categories::Family', foreign_key: 'category_id' belongs_to :parent, class_name: 'Species' has_many :children, class_name: 'Species', foreign_key: 'parent_id' has_many :images, dependent: :destroy accepts_nested_attributes_for :images, allow_...
require 'javaclass/string_ux' module JavaClass module ClassFile # The module Constants is for separating namespaces. It contains the logic to parse constant pool constants. # Author:: Peter Kofler module Constants # Superclass of all constant values in the constant pool. Every ...
class Item < ApplicationRecord enum course_type: [:first_course, :second_course, :drink] has_and_belongs_to_many :menus has_many :item_orders has_many :orders, :through => :item_orders validates :name, :course_type, :price, presence: true mount_uploader :photo, ImageUploader end
# encoding: utf-8 #! /usr/bin/env ruby ## #13/03/2014 #Projet Picross équipe CrakeTeam # #Ce fichier contient la classe Partie, qui est constituée d'une Grille et de diverses paramètres #ici une description de la classe Partie. require_relative 'Grille' require_relative 'Aide' require 'fileutils' class Partie @g...
require 'spec_helper' module Fakes describe Fake do context 'when stubbing a method' do let(:invocations) { Hash.new } let(:sut) { Fake.new(invocations) } let(:symbol) { :hello } let(:new_method) { Object.new } context 'and the method is not currently setup to be called' do ...
class RenameProvince < ActiveRecord::Migration[5.0] def change rename_column :shipping_addresses, :providence, :province end end
module Paysafe module Api class CustomerVaultApi < BaseApi def create_address(profile_id:, country:, zip:, **args) data = args.merge({ country: country, zip: zip }) perform_post_with_object("/customervault/v1/profiles/#{profile_id}/addresses", data, Address) end def create_card...
class Ability include CanCan::Ability def initialize(user) user ||= User.new can [:read], Shelter can [:update, :read], Shelter, user_id: user.id can [:manage], Animal, shelter: { user_id: user.id } can [:index, :show], Animal can [:manage], Photo do |photo| resource = photo.pa...
class Render def self.board(board) clear spacing column_numbers board.each do |row| format_cells(row) end column_numbers spacing end def self.clear system("cls") || system("clear") || puts("\e[H\e[2J") end def self.column_numbers puts "- 1 - 2 - 3 - 4 - 5 - 6 - 7 -"...
require 'spec_helper' describe 'Date picker', reset: false do before :all do Capybara.reset_sessions! load_page :search end context "range pickers" do context "when selecting a start date" do before :all do click_link 'Temporal' find('.temporal-range-start').click find(...
require_relative "Vehiculo.rb" class Lancha < Vehiculo def initialize(a=1) @llave = a end def arrancar() if (@llave==1) puts "Arrancando Lancha" else puts "no puede arrancar Lancha" end end end
class Book < ApplicationRecord belongs_to :user validates :book_title, presence: true validates :book_body, length: { maximum: 200 } validates :book_body, presence: true end
# frozen_string_literal: true module ApplicationHelper # rubocop:disable Rails/OutputSafety # html_safe: No user content def formatted_error_flash(error) if error.present? && error.is_a?(String) error elsif error.present? && error&.count == 1 error.first elsif error.present? errors ...
# frozen_string_literal: true class Api::V1::AddressesController < ApplicationController include ApiResponse before_action :set_address, only: %i[update destroy] before_action :set_addressable, only: :index before_action :authorize, only: %i[update destroy] def index @addresses = @addressable.addresses...
class LittersController < ApplicationController before_action :set_litter, only: [:show, :edit, :update, :destroy] access all: [:show], admin: :all # GET /litters # GET /litters.json def index @litters = Litter.all end # GET /litters/1 # GET /litters/1.json def show end # GET /litters/new ...
# frozen_string_literal: true require 'spec_helper' RSpec.describe SolidusPaysafe::Gateway do subject(:gateway) do described_class.new(gateway_options) end let(:gateway_options) do { api_key: 'api_key', api_secret: 'API_SECRET', test_mode: true, account_number: '000', sing...
class User < ActiveRecord::Base include RatingAverage has_secure_password validates :username, uniqueness: true, length: { minimum: 3} validates_format_of :password, :with => /(?=.*[A-Z])(?=.{4,}).+/, :on => :create has_many :ratings, dependent: :destroy has_many :beers, through: :ratings has_many :...
# frozen_string_literal: true module Tikkie module Api module V1 module Types module PaymentRequestStatus OPEN = "OPEN" CLOSED = "CLOSED" EXPIRED = "EXPIRED" MAX_YIELD_REACHED = "MAX_YIELD_REACHED" MAX_SUCCESSFUL_PAYMENTS_REACHED = "MAX_SUCCESSFUL_P...
class RemoveDeliveryFeeFromItems < ActiveRecord::Migration def change remove_column :items, :delivery_fee, :jsonb end end
module Skore module API class DepartmentUsers < Chainable include Skore::DB::DepartmentUsers def query { only: %i(id user_ids) } end def path '/departments' end end end end
if defined? Capistrano # We're running in Capistrano, only load tasks require 'panter-rails-deploy/capistrano' load File.expand_path('../../capistrano/tasks/panter-rails-deploy.rake', __FILE__) else # We're running the application, load supporting gems require 'panter-rails-deploy/rack' end
class ParticularPayment < ActiveRecord::Base belongs_to :finance_fee belongs_to :finance_fee_particular belongs_to :finance_transaction has_many :particular_discounts, :dependent=>:destroy after_create :update_transaction_date accepts_nested_attributes_for :particular_discounts, :allow_destroy=>true # ...
class CreateMovies < ActiveRecord::Migration[5.2] def change create_table :movies do |t| t.string :title, null: false t.integer :year, null: false t.integer :seasons t.string :director, null: false t.string :case, null: false t.string :writers, null: false t.string :g...
$TESTING = true $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'simplecov' require 'sony_camera_remote_api' require 'sony_camera_remote_api/scripts' require 'sony_camera_remote_api/client/main' require 'sony_camera_remote_api/utils' require 'sony_camera_remote_api/shelf' require 'io/console' requi...
class ReviewsController < ApplicationController before_action :logged_in_user, only: [:create, :destroy] def index @menu = Menu.find(params[:menu_id]) @reviews = @menu.reviews end def create @review = Review.new(review_params) @review.user_id = current_user.id if @review.save redirect...
Rails.application.routes.draw do mount Clockface::Engine => "/clockface" mount Sidekiq::Web => "/sidekiq" root to: "home#index" end
class User < ApplicationRecord include BCrypt has_many :shops_users, dependent: :destroy has_many :shops, through: :shops_users, dependent: :destroy has_many :sales, class_name: 'Order', foreign_key: 'seller_id' has_many :purchases, class_name: 'Order', foreign_key: 'buyer_id' validates_presence_of :usernam...