Skip to content

Instantly share code, notes, and snippets.

View esparkman's full-sized avatar

Evan Sparkman esparkman

View GitHub Profile
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
has_many :lists
def create
@ticket = Ticket.find(params[:ticket_id])
@note = @ticket.notes.create(params[:note])
if @note.save
flash[:notice] = "Successfully created note."
redirect_to ticket_path(@ticket)
else
render :action => 'new'
end
end
def to_key
new_record? ? nil : [ self.send(self.class.primary_key) ]
end
def persisted?
false
end
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module Ticketee
class Application < Rails::Application
Template is missing
Missing template users/create with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml, :haml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/Users/esparkman/Programming/Rails/unfiniti/app/views"
<%= form_for(@user) do |f| %>
<% if @user.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
class Ticket < ActiveRecord::Base
belongs_to :person, :foreign_key => 'person_id', :class_name => 'Person'
belongs_to :user, :foreign_key => 'user_id', :class_name => 'User'
belongs_to :company
# scope :open_tickets, where(:status => 'Open')
validates_numericality_of :priority_level, :allow_blank => true
# validates_inclusion_of :call_type, :in => Ticket::Types.values, :allow_blank => true
<%= div_for(comment) do %>
<h4><%= comment.user %></h4>
<%= simple_format(comment.text) %>
<% end %>
ruby-1.9.2-p0 > c = Comment.first
=> #<Comment id: 1, text: "This is a Note!", ticket_id: 1, user_id: 1, created_at: "2010-12-09 19:19:36", updated_at: "2010-12-09 19:19:36">
ruby-1.9.2-p0 > c.user.or
c.user.or c.user.ord c.user.order c.user.order! c.user.order=
c.user.order_clauses c.user.order_values c.user.order_values= c.user.orders c.user.orders=
c.user.ordinalize c.user.orig_name c.user.orig_name= c.user.original_encoding c.user.original_exception
c.user.original_filename c.user.original_filename= c.user.original_headers c.user.original_name c.user.original_platform
c.user.original_platform=
ruby-1.9.2-p0 > c.user.profile
=> #<Profile id: 5, user_id: 1, first_name: "Evan", last_name: "Sparkman", extension: "", created_at: "2010-11-30 21:59:05", updated_at: "2010-11-30 21:59:05">
TypeError (can't convert String into Integer):
app/models/user.rb:12:in `[]'
app/models/user.rb:12:in `find_for_google_apps_oauth'
app/controllers/users/omniauth_callbacks_controller.rb:17:in `google_apps'