Skip to content

Instantly share code, notes, and snippets.

@user = User.new {
email: "user#{n}@7ey.es",
first_name: Forgery(:name).first_name,
last_name: Forgery(:name).last_name,
password: 'letmein',
remember_me: true,
}
Petes-Mac-mini:tguard pete$ rake spec --trace
** Invoke spec (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
it "should be able to have transcripts added to it" do
# A has_many Bs
a = A.new ({
name: 'Name',
})
a.save
a.should be_an_instance_of(A) #Passes
require 'spec_helper'
require 'LoginHelper'
require 'rake'
describe "Admin User CRUD" do
include LoginHelper
it 'should list users' do
Rake::Task['db:populate'].invoke '10'
def show
begin
@company = Company.find params[:id].to_i
rescue ActiveRecord::RecordNotFound
#do nothing
end
if @company.present?
@vendors = @company.vendors
end
@other_things = @thing.other_things.order('created_at ASC') unless @other_things.present?
total_count = @other_things.count
<% form_for info, :html => { :class => 'form-horizontal' } do |f| %>
<div class='control-group<%= " error" if info.errors.has_key?(:lawfirm) %>'>
<label class='control-label'>Firm</label>
<div class='controls'>
<%= f.collection_select :lawfirm_id, Lawfirm.all, :id, :name %>
<% if info.errors.has_key?(:lawfirm) %>
<span class='help-inline'>Lawfirm <%= info.errors.get(:lawfirm).first %></span>
<% end %>
</div>
resources :lawfirms, :only => [ :show, :new, :create, :lawyer ] do
collection do
get :lawyers
end
end
class LawyersController < ApplicationController
before_filter :authenticate_user!
before_filter :find_lawfirm
load_and_authorize_resource
layout 'application'
NameError (uninitialized constant Lawyer):
rake (0.9.2.2) lib/rake/ext/module.rb:36:in `const_missing'
activesupport (3.2.3) lib/active_support/inflector/methods.rb:229:in `block in constantize'
activesupport (3.2.3) lib/active_support/inflector/methods.rb:228:in `each'
activesupport (3.2.3) lib/active_support/inflector/methods.rb:228:in `constantize'
activesupport (3.2.3) lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
cancan (1.6.7) lib/cancan/controller_resource.rb:141:in `resource_class'
cancan (1.6.7) lib/cancan/controller_resource.rb:181:in `resource_base'
cancan (1.6.7) lib/cancan/controller_resource.rb:77:in `load_collection?'
cancan (1.6.7) lib/cancan/controller_resource.rb:33:in `load_resource'