Skip to content

Instantly share code, notes, and snippets.

module ParserModule
attr :pm_data, :pm_pages
def pages
if @pm_pages.nil?
@pm_pages = @pm_data.split /^\d{4}\s*$/
end
@pm_pages
end
module ParserModule
data = nil
pages = nil
def data=d
data = d
end
def data
data
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'
class LawyersController < ApplicationController
before_filter :authenticate_user!
before_filter :find_lawfirm
load_and_authorize_resource
layout 'application'
resources :lawfirms, :only => [ :show, :new, :create, :lawyer ] do
collection do
get :lawyers
end
end
<% 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>
@other_things = @thing.other_things.order('created_at ASC') unless @other_things.present?
total_count = @other_things.count
def show
begin
@company = Company.find params[:id].to_i
rescue ActiveRecord::RecordNotFound
#do nothing
end
if @company.present?
@vendors = @company.vendors
end
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'
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