This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AdminTemplatesController < ApplicationController | |
| def new | |
| @admin_template = AdminTemplate.new | |
| render 'admin/templates/form', layout: (not request.xhr?) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def print_example | |
| @print = Pdf::TicketDetail.find(params[:id]) | |
| drop = TicketDrop.new(@ticket) | |
| drop.generate_ticket TicketAttrs.for(session) | |
| @output = Liquid::Template.parse(@print.body).render('pdf_ticket_details' => drop).html_safe | |
| render layout: false | |
| end | |
| def create_example | |
| @ticket = Pdf::Ticket.find(params[:id]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class EnrollmentController < ApplicationController | |
| def new | |
| @users_assignments = [] | |
| 3.times{ @users_assignments << @event.assignments.build } | |
| end | |
| def create | |
| @event = Event.new params[:event] | |
| @event. | |
| redirect_to 'new' and return unless @event.save |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Image < AR::Base | |
| validates :src, presence: true | |
| validate :set_status_to_missing_url, :if => lambda { src.blank? } | |
| def process | |
| @logo_image = RmagickHelper.new self.src | |
| rescue Magick::ImageMagickError => ex | |
| logger.error "ImageMagick can not process the image: #{ex.message}" | |
| ex.backtrace.each { |line| logger.debug line } | |
| @logo_status = 'cant_process' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module UsersHelper | |
| #Returns the Gravatar for the given user. | |
| def gravatar_for(user, options = { size: 50 }) | |
| gravatar_id = Digest::MD5::hexdigest(user.email.downcase) | |
| size = options[:size] | |
| gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}" | |
| image_tag(gravatar_url, alt: user.email, class: "img-responsive") | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module UsersHelper | |
| #Returns the Gravatar for the given user. | |
| def gravatar_for(user, options = { size: 50 }) | |
| gravatar_id = Digest::MD5::hexdigest(user.email.downcase) | |
| size = options[:size] | |
| gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}" | |
| image_tag(gravatar_url, alt: user.email, class: "img-responsive") | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 :require_login | |
| helper_method :current_user | |
| private |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CreateWords < ActiveRecord::Migration | |
| def change | |
| create_table :words do |t| | |
| t.string :text | |
| t.integer :frequency | |
| t.integer :mistakes | |
| t.timestamps | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| describe User do | |
| it "has a valid factory" do | |
| build(:user).should be_valid | |
| end | |
| it "is invalid without an email" do | |
| build(:user, email: nil).should_not be_valid | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 7 class ChargeMailer < ActionMailer::Base | |
| 6 default :from => "[email protected]" | |
| 5 | |
| 4 def registration_confirmation(cust) | |
| 3 @customer = cust | |
| 2 mail(:to => "#{cust.email}", :subject => "Your Order Confirmation") | |
| 1 end | |
| 0 end | |
| ~ |