code
stringlengths
1
1.73M
language
stringclasses
1 value
class ReportTemplatesController < ApplicationController before_filter :login_required # GET /report_templates # GET /report_templates.xml def index @report_templates = ReportTemplate.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @report_template...
Ruby
class UsersController < ApplicationController before_filter :login_required # render new.rhtml def new @groups = Group.find(:all) @heading = 'New user' @user = User.new end def set_password @user = User.find(params[:id]) @heading = "Set user's password" return unless request.p...
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. #require 'rutils' class ApplicationController < ActionController::Base # Pick a unique cookie name to distinguish our session data from others' session :session_ke...
Ruby
class GroupsController < ApplicationController before_filter :login_required # GET /groups # GET /groups.xml def index @groups = Group.find(:all) respond_to do |format| format.html # index.rhtml format.xml { render :xml => @groups.to_xml } end end # GET /groups/1 # GET /group...
Ruby
class TicketsController < ApplicationController before_filter :login_required def index groups = []; current_user.groups.each {|group| groups << group.id.to_s} if current_user.groups if !params[:group] @tickets = Ticket.find(:all, :order => 'deadline', :conditions => [ "group_id IN (?)", grou...
Ruby
# This controller handles the login/logout function of the site. class SessionsController < ApplicationController # Be sure to include AuthenticationSystem in Application Controller instead include AuthenticatedSystem # render new.rhtml def new if User.count < 1 User.create_first_user end i...
Ruby
ActionController::Routing::Routes.draw do |map| map.resources :report_templates map.resources :groups # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind yo...
Ruby
# Don't change this file! # Configure your app in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? preinitialize pick_boot.run end end def booted? ...
Ruby
# Be sure to restart your web server when you modify this file. # Uncomment below to force Rails into production mode when # you don't control web/app server and can't set it the proper way # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION ...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Use a different logger for distributed setups # config.logger = SyslogLogger.new # Full error repor...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.ca...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between...
Ruby
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'tasks/rails'
Ruby
module AuthenticatedSystem protected # Returns true or false if the user is logged in. # Preloads @current_user with the user model if they're logged in. def logged_in? current_user != :false end # Accesses the current user from the session. Set it to :false if login fails # so tha...
Ruby
module AuthenticatedTestHelper # Sets the current user in the session from the user fixtures. def login_as(user) @request.session[:user] = user ? users(user).id : nil end def authorize_as(user) @request.env["HTTP_AUTHORIZATION"] = user ? "Basic #{Base64.encode64("#{users(user).login}:test")}" : nil e...
Ruby
task :agiledox do tests = FileList['test/**/*_test.rb'] tests.each do |file| m = %r".*/([^/].*)_test.rb".match(file) puts m[1]+" should:\n" test_definitions = File::readlines(file).select {|line| line =~ /.*def test.*/} test_definitions.each do |definition| m = %r"test_(should_)?(.*)".match(d...
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'data_mapper', '~> 1.2' gem 'dm-postgres-adapter' gem 'google-api-client', '>= 0.4.3' group :development do gem 'dm-sqlite-adapter', '~> 1.2' gem 'do_sqlite3', '~> 0.10' end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'data_mapper', '~> 1.2' gem 'dm-postgres-adapter' gem 'google-api-client', '>= 0.4.3' group :development do gem 'dm-sqlite-adapter', '~> 1.2' gem 'do_sqlite3', '~> 0.10' end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
# :title:Addicted To Ma.gnolia by John Nunemaker # = Addicted To Ma.gnolia # # This class makes it really simple to access your Ma.gnolia bookmarks # using the Ma.gnolia API[http://ma.gnolia.com/support/api/]. # # Author:: John Nunemaker # Website:: http://addictedtonew.com # Last Updated:: June 3, 2006 @ 12:57AM EST ...
Ruby
require 'magnolia' # This is a test account I set up. Please do not use this key or mess with the test account. Thanks. Magnolia.new('fc18b7bd1caf67b06b16a462b0b3c00890304ad9') puts '---Testing the adding of a bookmark...' begin marks = Magnolia.add(:title => 'Addicted To New', :description =...
Ruby
# :title:Addicted To Ma.gnolia by John Nunemaker # = Addicted To Ma.gnolia # # This class makes it really simple to access your Ma.gnolia bookmarks # using the Ma.gnolia API[http://ma.gnolia.com/support/api/]. # # Author:: John Nunemaker # Website:: http://addictedtonew.com # Last Updated:: June 3, 2006 @ 12:57AM EST ...
Ruby
require 'magnolia' # This is a test account I set up. Please do not use this key or mess with the test account. Thanks. Magnolia.new('fc18b7bd1caf67b06b16a462b0b3c00890304ad9') puts '---Testing the adding of a bookmark...' begin marks = Magnolia.add(:title => 'Addicted To New', :description =...
Ruby
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "ubuntu/trusty64" config.vm.hostname = "vagrant-kasan" # Disable default synced folder (asan kernel doesn't have Virtualbox modules). #config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.provider :virt...
Ruby
require 'add_column_after' class ActiveRecord::ConnectionAdapters::MysqlAdapter include BrionesAndCo::ActiveRecord::ConnectionAdapters::AddColumnAfter end
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the add_column_after plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the add_column_af...
Ruby
module BrionesAndCo module ActiveRecord module ConnectionAdapters module AddColumnAfter def add_column_options!(sql, options) #:nodoc: sql << " DEFAULT #{quote(options[:default], options[:column])}" if options_include_default?(options) sql << " NOT NULL" if options[:null...
Ruby
require 'test/unit' require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/environment.rb')) module AddColumnAfter class AdapterNotSupported < StandardError; end; end config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml')) if configuration = config[ENV['DB'] || 'mysql'] if c...
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'data_mapper', '~> 1.2' gem 'dm-postgres-adapter' gem 'google-api-client', '>= 0.4.3' group :development do gem 'dm-sqlite-adapter', '~> 1.2' gem 'do_sqlite3', '~> 0.10' end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
# coding= utf-8 # 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 rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities =City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create...
Ruby
class CreateEducations < ActiveRecord::Migration def change create_table :educations do |t| t.string :name t.timestamps end end end
Ruby
class CreateCategories < ActiveRecord::Migration def change create_table :categories do |t| t.timestamps end end end
Ruby
class CreateJobs < ActiveRecord::Migration def change create_table :jobs do |t| t.string :title t.timestamps end end end
Ruby
class CreateCities < ActiveRecord::Migration def change create_table :cities do |t| t.string :name t.integer :county_id t.timestamps end end end
Ruby
class AddPublishedColumnToJob < ActiveRecord::Migration def change add_column :jobs, :published, :boolean end end
Ruby
class DropCvTable < ActiveRecord::Migration def up drop_table :cvs end def down end end
Ruby
class AddDutiesAndPlaceAndEtcToJob < ActiveRecord::Migration def change add_column :jobs, :duties, :text add_column :jobs, :requirements, :text add_column :jobs, :preferences, :text add_column :jobs, :offer, :text add_column :jobs, :apply, :text add_column :jobs, :city_id, :integer add_column :jo...
Ruby
class DeviseCreateUsers < ActiveRecord::Migration def change create_table(:users) do |t| ## Database authenticatable t.string :email, null: false, default: "" t.string :encrypted_password, null: false, default: "" ## Recoverable t.string :reset_password_token t....
Ruby
class CreateAuthentications < ActiveRecord::Migration def self.up create_table :authentications do |t| t.integer :user_id t.string :provider t.string :uid t.timestamps end end def self.down drop_table :authentications end end
Ruby
class AddLanguageIdToCv < ActiveRecord::Migration def change add_column :cvs, :language_id, :integer end end
Ruby
class AddAttachmentsBlobToCv < ActiveRecord::Migration def self.up add_column :cvs, :cv_file, :binary end def self.down remove_column :cvs, :cv_file end end
Ruby
class AddCvColumnsToCvs < ActiveRecord::Migration def self.up add_attachment :cvs, :cv end def self.down remove_attachment :cvs, :cv end end
Ruby
class CreateCkeditorAssets < ActiveRecord::Migration def self.up create_table :ckeditor_assets do |t| t.string :data_file_name, :null => false t.string :data_content_type t.integer :data_file_size t.integer :assetable_id t.string :assetable_type, :limit => 30 t.string :typ...
Ruby
class CreateFavorites < ActiveRecord::Migration def change create_table :favorites do |t| t.integer :user_id t.integer :job_id t.timestamps end end end
Ruby
class AddAvatarToUser < ActiveRecord::Migration def self.up add_attachment :users, :avatar end def self.down remove_attachment :users, :avatar end end
Ruby
class AddColumnsToUser < ActiveRecord::Migration def change add_column :users, :login, :string add_column :users, :birthday, :date add_column :users, :gender, :boolean end end
Ruby
class CreatePosts < ActiveRecord::Migration def change create_table :posts do |t| t.string :title t.integer :user_id t.text :content t.integer :priority t.boolean :published t.text :short_content t.integer :counter t.string :slug t.timestamps end end en...
Ruby
class AddColumnsToSomething < ActiveRecord::Migration def change add_column :categories, :title, :string add_column :categories, :description, :string add_column :jobs, :short_content, :string end end
Ruby
class CreateCounties < ActiveRecord::Migration def change create_table :counties do |t| t.string :name t.integer :country_id t.timestamps end end end
Ruby
class AddUserIdToAttend < ActiveRecord::Migration def change add_column :attends, :user_id, :integer add_column :attends, :job_id, :integer end end
Ruby
class DropAuthenticationsTable < ActiveRecord::Migration def up drop_table :authentications end def down end end
Ruby
class AddColumnsToJob < ActiveRecord::Migration def self.up add_column :jobs, :description, :string end def self.down remove_column :jobs, :description, :string end end
Ruby
class AddNameToUser < ActiveRecord::Migration def change add_column :users, :name, :string end end
Ruby
class CreateAttends < ActiveRecord::Migration def change create_table :attends do |t| t.timestamps end end end
Ruby
class AddCategoryIdToJobs < ActiveRecord::Migration def change add_column :jobs, :category_id, :integer end end
Ruby
class CreateLanguages < ActiveRecord::Migration def change create_table :languages do |t| t.string :name t.timestamps end end end
Ruby
class CreateCvCvs < ActiveRecord::Migration def self.up create_table :cvs do |t| t.integer :user_id t.integer :language_id t.timestamps end end def self.down drop_table :cvs end end
Ruby
class AddCompanyIdToJob < ActiveRecord::Migration def change add_column :jobs, :company_id, :integer end end
Ruby
class CreateCvs < ActiveRecord::Migration def change create_table :cvs do |t| t.integer :user_id t.integer :language_id t.timestamps end end end
Ruby
class CreateCountries < ActiveRecord::Migration def change create_table :countries do |t| t.string :name t.timestamps end end end
Ruby
class ChangeUserColumns < ActiveRecord::Migration def up change_column :users, :email, :string, :null => true change_column :users, :encrypted_password, :string, :null => true end def down end end
Ruby
class AddAvatarToCompany < ActiveRecord::Migration def self.up add_attachment :companies, :avatar end def self.down remove_attachment :companies, :avatar end end
Ruby
class AddTokenToAuthentication < ActiveRecord::Migration def change add_column :authentications, :token, :string add_column :authentications, :token_secret, :string end end
Ruby
class DeviseCreateCompanies < ActiveRecord::Migration def change create_table(:companies) do |t| ## Database authenticatable t.string :email, null: false, default: "" t.string :encrypted_password, null: false, default: "" ## Recoverable t.string :reset_password_token ...
Ruby
class RolifyCreateRoles < ActiveRecord::Migration def change create_table(:roles) do |t| t.string :name t.references :resource, :polymorphic => true t.timestamps end create_table(:users_roles, :id => false) do |t| t.references :user t.references :role end create_ta...
Ruby
class AddNameToCompany < ActiveRecord::Migration def change add_column :companies, :name, :string end end
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integrati...
Ruby
source 'https://rubygems.org' gem 'rails', '3.2.16' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'thin' gem 'activerecord-oracle_enhanced-adapter', '~> 1.4.0' gem 'ruby-oci8', '~> 2.1.0' gem 'bootstrap-sass' # Authentication and session controlling gem 'devise' # Ca...
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
json.extract! @cv, :id, :user_id, :created_at, :updated_at
Ruby
json.array!(@cvs) do |cv| json.extract! cv, :id, :user_id json.url cv_url(cv, format: :json) end
Ruby
json.extract! @post, :id, :title, :user_id, :content, :priority, :published, :short_content, :counter, :slug, :created_at, :updated_at
Ruby
json.array!(@posts) do |post| json.extract! post, :id, :title, :user_id, :content, :priority, :published, :short_content, :counter, :slug json.url post_url(post, format: :json) end
Ruby
json.extract! @category, :id, :created_at, :updated_at
Ruby
json.array!(@categories) do |category| json.extract! category, :id json.url category_url(category, format: :json) end
Ruby
json.extract! @attend, :id, :created_at, :updated_at
Ruby
json.array!(@attends) do |attend| json.extract! attend, :id json.url attend_url(attend, format: :json) end
Ruby
module WelcomeHelper end
Ruby
module ApplicationHelper include ActionView::Helpers::UrlHelper end
Ruby
module CountriesHelper end
Ruby
module FavoritesHelper end
Ruby
module JobsHelper end
Ruby
module JobHelper end
Ruby
#coding:utf-8 module UsersHelper def admin_role_title(user) if !user.nil? (user.has_role?(:admin) ? "Admin jog elvétele" : "Admin jog adása") end end def moderator_role_title(user) if !user.nil? (user.has_role?(:moderator) ? "Moderátor jog elvétele" : "Moderátor jog adása") end end def normal_role_ti...
Ruby
module PostsHelper end
Ruby
module AuthenticationsHelper end
Ruby
module CvsHelper end
Ruby
module CitiesHelper end
Ruby
module CategoriesHelper end
Ruby
module AttendsHelper end
Ruby
module SearchHelper end
Ruby
module EducationHelper end
Ruby
module LanguageHelper end
Ruby
module CountiesHelper end
Ruby
module CompaniesHelper end
Ruby
class Ckeditor::Asset < ActiveRecord::Base include Ckeditor::Orm::ActiveRecord::AssetBase include Ckeditor::Backend::Paperclip end
Ruby
class Ckeditor::AttachmentFile < Ckeditor::Asset has_attached_file :data, :url => "/ckeditor_assets/attachments/:id/:filename", :path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename" validates_attachment_presence :data validates_attachment_size :data, :les...
Ruby
class Ckeditor::Picture < Ckeditor::Asset has_attached_file :data, :url => "/ckeditor_assets/pictures/:id/:style_:basename.:extension", :path => ":rails_root/public/ckeditor_assets/pictures/:id/:style_:basename.:extension", :styles => { :content => '800>', ...
Ruby