code
stringlengths
1
1.73M
language
stringclasses
1 value
module RecurringTransactionsHelper end
Ruby
class RecurringTransactionsController < ApplicationController # GET /recurring_transactions # GET /recurring_transactions.xml def index @recurring_transactions = RecurringTransaction.find(:all) @recurring_transaction = RecurringTransaction.new respond_to do |format| format.html # index.html.erb...
Ruby
class TransactionsController < ApplicationController # GET /transactions # GET /transactions.xml def index @period = Period.find(params[:period_id]) @transactions = @period.transactions @transaction = Transaction.new respond_to do |format| format.html # index.html.erb format.xml { re...
Ruby
class PeriodsController < ApplicationController # GET /periods # GET /periods.xml def index @periods = Period.find(:all, :order => "start_date DESC") @period = Period.new @period.init_period respond_to do |format| format.html # index.html.erb format.xml { render :xml => @periods } ...
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base helper :all # include all helpers, all the time # See ActionController::RequestForgeryProtection for details...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class Test::Unit::TestCase # Transactional fixtures accelerate your tests by wrapping each test method # in a transaction that's rolled back on completion. This ensures that the # test datab...
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 # Enable threaded mode # config.threadsafe! # Use a different logger for distributed setups # config....
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
ActionController::Routing::Routes.draw do |map| map.resources :recurring_transactions map.resources :periods, :has_many => :transactions, :shallow => true map.resources :transactions, :only => [:index] map.connect ':controller/:action/:id' map.root :periods # The priority is based upon order of creation: f...
Ruby
# These settings change the behavior of Rails 2 apps and will be defaults # for Rails 3. You can remove this initializer when Rails 3 is released. if defined?(ActiveRecord) # Include Active Record class name as root for JSON serialized output. ActiveRecord::Base.include_root_in_json = true # Store the full clas...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person',...
Ruby
# Be sure to restart your 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 = '2.2...
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
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the Fast...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the Fast...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat...
Ruby
#!/usr/bin/env ruby require 'blueprint/blueprint' require 'blueprint/validator' # This script will validate the core Blueprint files. # # The files are not completely valid. This has to do # with a small number of CSS hacks needed to ensure # consistent rendering across browsers. # # To add your own CSS files for...
Ruby
#!/usr/bin/env ruby require File.join(File.dirname(__FILE__), "blueprint", "blueprint") # **Basic # # Calling this file by itself will pull files from blueprint/src and concatenate them into three files; ie.css, print.css, and screen.css. # # ruby compress.rb # # However, argument variables can be set to ch...
Ruby
#!/usr/bin/env ruby require File.join(File.dirname(__FILE__), "blueprint", "blueprint") # **Basic # # Calling this file by itself will pull files from blueprint/src and concatenate them into three files; ie.css, print.css, and screen.css. # # ruby compress.rb # # However, argument variables can be set to ch...
Ruby
require 'yaml' require 'optparse' module Blueprint class Compressor TEST_FILES = ['index.html', 'parts/elements.html', 'parts/forms.html', 'parts/grid.html', 'parts/sample.html'] attr_accessor :namespace, :custom_css, :custom_lay...
Ruby
module Blueprint # parses a hash of key/value pairs, key being output CSS selectors, value being a list of CSS selectors to draw from class SemanticClassNames attr_accessor :class_assignments attr_reader :namespace, :source_file # ==== Options # * <tt>options</tt> # * <tt>:namespace</tt> ...
Ruby
begin require 'rubygems' gem 'rmagick' require 'rvg/rvg' rescue Exception => e end module Blueprint # Uses ImageMagick and RMagick to generate grid.png file class GridBuilder begin include Magick rescue Exception => e end attr_reader :column_width, :gutter_width, :output_path, :able_to...
Ruby
module Blueprint # Strips out most whitespace and can return a hash or string of parsed data class CSSParser attr_accessor :namespace attr_reader :css_output, :raw_data # ==== Options # * <tt>css_string</tt> String of CSS data # * <tt>options</tt> # * <tt>:namespace</tt> -- Namespace ...
Ruby
module Blueprint class Namespace # Read html to string, remove namespace if any, # set the new namespace, and update the test file. def initialize(path, namespace) html = File.path_to_string(path) remove_current_namespace(html) add_namespace(html, namespace) File.string_to_file(...
Ruby
require 'erb' module Blueprint # Generates a custom grid file, using ERB to evaluate custom settings class CustomLayout # path to ERB file used for CSS template CSS_ERB_FILE = File.join(Blueprint::LIB_PATH, 'grid.css.erb') attr_writer :column_count, :column_width, :gutter_width # Column count of...
Ruby
class String # see if string has any content def blank?; self.length.zero?; end # strip space after :, remove newlines, replace multiple spaces with only one space, remove comments def strip_space! replace self.gsub(/:\s*/, ':').gsub(/\n/, '').gsub(/\s+/, ' ').gsub(/(\/\*).*?(\*\/)/, '') end # rem...
Ruby
module Blueprint # Validates generated CSS against the W3 using Java class Validator attr_reader :error_count def initialize @error_count = 0 end # Validates all three CSS files def validate java_path = `which java`.rstrip raise "You do not have a Java installed, but it i...
Ruby
require 'fileutils' module Blueprint # path to the root Blueprint directory ROOT_PATH = File.join(File.expand_path(File.dirname(__FILE__)), "../../") # path to where the Blueprint CSS files are stored BLUEPRINT_ROOT_PATH = File.join(Blueprint::ROOT_PATH, 'blueprint') # path to where the Blueprin...
Ruby
#!/usr/bin/env ruby require 'blueprint/blueprint' require 'blueprint/validator' # This script will validate the core Blueprint files. # # The files are not completely valid. This has to do # with a small number of CSS hacks needed to ensure # consistent rendering across browsers. # # To add your own CSS files for...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat...
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end 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
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
# Simple Jobs # =========== require 'java' java_import Java::MyscheduleQuartzExtraJob::LoggerJob java_import Java::MyscheduleQuartzExtraJob::ScriptingJob java_import Java::MyscheduleQuartzExtra::SchedulerTemplate java_import Java::JavaUtil::Date java_import Java::JavaLang::System # Schedule hourly job scheduler.schedu...
Ruby
# Simple Jobs # =========== require 'java' java_import Java::MyscheduleQuartzExtraJob::LoggerJob java_import Java::MyscheduleQuartzExtraJob::ScriptingJob java_import Java::MyscheduleQuartzExtra::SchedulerTemplate java_import Java::JavaUtil::Date java_import Java::JavaLang::System # Schedule hourly job scheduler.schedu...
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end 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
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
#!/usr/bin/env ruby require 'fileutils' # Create the compiled locales directory. # You can specify it as COMPILED_LOCALES_DIR in the environment, # or it will be $SRCROOT/__Compiled Locales. compiledDir = ENV['COMPILED_LOCALES_DIR'] || File.join(ENV['SRCROOT'], '__Compiled Locales') Dir.mkdir(compiledDir) unless Fil...
Ruby
#!/usr/bin/env ruby require 'fileutils' # Create the compiled locales directory. # You can specify it as COMPILED_LOCALES_DIR in the environment, # or it will be $SRCROOT/__Compiled Locales. compiledDir = ENV['COMPILED_LOCALES_DIR'] || File.join(ENV['SRCROOT'], '__Compiled Locales') Dir.mkdir(compiledDir) unless Fil...
Ruby
#!/usr/bin/env ruby require 'find' SRCROOT = ENV['SRCROOT'] || '.' ISO_NAMED_DIR = File.join(SRCROOT, 'en.lproj') NEXT_NAMED_DIR = File.join(SRCROOT, 'English.lproj') BASE_LOCALE_DIR = (ENV['BASE_LOCALE_DIR']) || (NEXT_NAMED_DIR if File.directory? NEXT_NAMED_DIR) || (ISO_NAMED_DIR if File.directory? ISO_NAMED_...
Ruby
#!/usr/bin/env ruby require 'find' SRCROOT = ENV['SRCROOT'] || '.' ISO_NAMED_DIR = File.join(SRCROOT, 'en.lproj') NEXT_NAMED_DIR = File.join(SRCROOT, 'English.lproj') BASE_LOCALE_DIR = (ENV['BASE_LOCALE_DIR']) || (NEXT_NAMED_DIR if File.directory? NEXT_NAMED_DIR) || (ISO_NAMED_DIR if File.directory? ISO_NAMED_...
Ruby
#!/usr/bin/env ruby require 'fileutils' # Create the compiled locales directory. # You can specify it as COMPILED_LOCALES_DIR in the environment, # or it will be $SRCROOT/__Compiled Locales. compiledDir = ENV['COMPILED_LOCALES_DIR'] || File.join(ENV['SRCROOT'], '__Compiled Locales') Dir.mkdir(compiledDir) unless Fil...
Ruby
#!/usr/bin/env ruby require 'fileutils' # Create the compiled locales directory. # You can specify it as COMPILED_LOCALES_DIR in the environment, # or it will be $SRCROOT/__Compiled Locales. compiledDir = ENV['COMPILED_LOCALES_DIR'] || File.join(ENV['SRCROOT'], '__Compiled Locales') Dir.mkdir(compiledDir) unless Fil...
Ruby
#!/usr/bin/env ruby require 'find' SRCROOT = ENV['SRCROOT'] || '.' ISO_NAMED_DIR = File.join(SRCROOT, 'en.lproj') NEXT_NAMED_DIR = File.join(SRCROOT, 'English.lproj') BASE_LOCALE_DIR = (ENV['BASE_LOCALE_DIR']) || (NEXT_NAMED_DIR if File.directory? NEXT_NAMED_DIR) || (ISO_NAMED_DIR if File.directory? ISO_NAMED_...
Ruby
#!/usr/bin/env ruby require 'find' SRCROOT = ENV['SRCROOT'] || '.' ISO_NAMED_DIR = File.join(SRCROOT, 'en.lproj') NEXT_NAMED_DIR = File.join(SRCROOT, 'English.lproj') BASE_LOCALE_DIR = (ENV['BASE_LOCALE_DIR']) || (NEXT_NAMED_DIR if File.directory? NEXT_NAMED_DIR) || (ISO_NAMED_DIR if File.directory? ISO_NAMED_...
Ruby
#!/usr/bin/env ruby # AgeFive # Modernizing Riven in Ruby # # init: Temporary launcher # # Created by Sören Nils Kuklau # Copyright (c) 2007. Some rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to ...
Ruby
#!/usr/bin/env ruby # AgeFive # Modernizing Riven in Ruby # # RivenBitmap: decoding and (if needed) decompressing tBMP bitmaps # # Created by Sören Nils Kuklau on 2007-04-29. # Copyright (c) 2007. Some rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software a...
Ruby
#!/usr/bin/env ruby # AgeFive # Modernizing Riven in Ruby # # Resource # # Created by Sören Nils Kuklau on 2007-04-29. # Copyright (c) 2007. Some rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to d...
Ruby
#!/usr/bin/env ruby # AgeFive # Modernizing Riven in Ruby # # Resource # # Created by Sören Nils Kuklau on 2007-04-29. # Copyright (c) 2007. Some rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to d...
Ruby
#!/usr/bin/env ruby # AgeFive # Modernizing Riven in Ruby # # OSInfo: convenience methods for OS-specific info, such as file system paths # # Created by Sören Nils Kuklau # Copyright (c) 2007. Some rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and a...
Ruby
#!/usr/bin/env ruby # AgeFive # Modernizing Riven in Ruby # # MohawkCatalog: Caching Mohawk archive contents # # Created by Sören Nils Kuklau # Copyright (c) 2007. Some rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files...
Ruby
#!/usr/bin/env ruby # AgeFive # Modernizing Riven in Ruby # # RivenBitmap: decoding and (if needed) decompressing tBMP bitmaps # # Created by Sören Nils Kuklau on 2007-04-29. # Copyright (c) 2007. Some rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software a...
Ruby
#!/usr/bin/env ruby # AgeFive # Modernizing Riven in Ruby # # ResourceType # # Created by Sören Nils Kuklau on 2007-04-29. # Copyright (c) 2007. Some rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), ...
Ruby
#!/usr/bin/env ruby # AgeFive # Modernizing Riven in Ruby # # ResourceType # # Created by Sören Nils Kuklau on 2007-04-29. # Copyright (c) 2007. Some rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), ...
Ruby
#!/usr/bin/env ruby # AgeFive # Modernizing Riven in Ruby # # OSInfo: convenience methods for OS-specific info, such as file system paths # # Created by Sören Nils Kuklau # Copyright (c) 2007. Some rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and a...
Ruby
#!/usr/bin/env ruby # AgeFive # Modernizing Riven in Ruby # # MohawkCatalog: Caching Mohawk archive contents # # Created by Sören Nils Kuklau # Copyright (c) 2007. Some rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files...
Ruby
#!/usr/bin/env ruby # AgeFive # Modernizing Riven in Ruby # # init-tBMP: Temporary launcher # # Created by Sören Nils Kuklau # Copyright (c) 2007. Some rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software")...
Ruby
#!/usr/bin/env ruby # AgeFive # Modernizing Riven in Ruby # # init: Temporary launcher # # Created by Sören Nils Kuklau # Copyright (c) 2007. Some rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to ...
Ruby
#!/usr/bin/env ruby # AgeFive # Modernizing Riven in Ruby # # init-tBMP: Temporary launcher # # Created by Sören Nils Kuklau # Copyright (c) 2007. Some rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software")...
Ruby
# $ext_path: This should be the path of where the ExtJS SDK is installed # Generally this will be in a lib/extjs folder in your applications root # <root>/lib/extjs $ext_path = "../../" # sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder # Generally this will be in a resource...
Ruby
# include the utils rb file which has extra functionality for the ext theme dir = File.dirname(__FILE__) require File.join(dir, 'lib', 'utils.rb') # register ext4 as a compass framework Compass::Frameworks.register 'ext4', dir
Ruby
# $ext_path: This should be the path of the Ext JS SDK relative to this file $ext_path = "../../extjs" # sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder # Generally this will be in a resources/sass folder # <root>/resources/sass sass_path = File.dirname(__FILE__) # css_pat...
Ruby
module ExtJS4 module SassExtensions module Functions module Utils def parsebox(list, n) assert_type n, :Number if !n.int? raise ArgumentError.new("List index #{n} must be an integer") elsif n.to_i < 1 raise ArgumentError.new("List index #{n} must...
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end 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
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', ...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
Ruby
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
Ruby
# Be sure to restart your server when you modify this file. # # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do wrap_parameters ...
Ruby
# Be sure to restart your server when you modify this file. Agend5::Application.config.session_store :cookie_store, key: '_agend5_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table with "rails gen...
Ruby
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a probl...
Ruby
Agend5::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false config.action_...
Ruby
Agend5::Application.configure do # Settings specified here will take precedence over those in config/application.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 web ser...
Ruby
Agend5::Application.configure do # Settings specified here will take precedence over those in config/application.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 sui...
Ruby
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application Agend5::Application.initialize!
Ruby
require 'rubygems' # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
Ruby
require File.expand_path('../boot', __FILE__) require 'rails/all' if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require(*Rails.groups(:assets => %w(development test))) # If you want your assets lazily compiled in production, use this line # Bundler.requi...
Ruby
Agend5::Application.routes.draw do resources :medicos get "home/index" resources :pacientes # The priority is based upon order of creation: # first created -> highest priority. # Sample of regular route: # match 'products/:id' => 'catalog#view' # Keep in mind you can assign values other than :co...
Ruby
module ApplicationHelper end
Ruby
module DoctorsHelper end
Ruby
module PatientsHelper end
Ruby
class Doctor < ActiveRecord::Base attr_accessible :adress, :cpf, :email, :name, :phone, :speciality end
Ruby
class Patient < ActiveRecord::Base attr_accessible :birth, :cpf, :email, :login, :name, :observations, :rg, :senha, :sex validates_presence_of :birth, :cpf, :login, :name, :senha, :sex validates_confirmation_of :senha validates_format_of :email, :with => /\A[^@]+@([^@\.]+\.)+[^@\.]+\z/ validates_uniqueness_of...
Ruby
class PatientsController < ApplicationController # GET /patients # GET /patients.json def index @patients = Patient.all respond_to do |format| format.html # index.html.erb format.json { render json: @patients } end end # GET /patients/1 # GET /patients/1.json def show @patien...
Ruby
class DoctorsController < ApplicationController # GET /doctors # GET /doctors.json def index @doctors = Doctor.all respond_to do |format| format.html # index.html.erb format.json { render json: @doctors } end end # GET /doctors/1 # GET /doctors/1.json def show @doctor = Docto...
Ruby
class ApplicationController < ActionController::Base protect_from_forgery end
Ruby
#!/usr/bin/env rake # 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.expand_path('../config/application', __FILE__) Agend5::Application.load_tasks
Ruby
#!/usr/bin/env rake # 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.expand_path('../config/application', __FILE__) Agend5::Application.load_tasks
Ruby