This file contains 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 ParserModule | |
attr :pm_data, :pm_pages | |
def pages | |
if @pm_pages.nil? | |
@pm_pages = @pm_data.split /^\d{4}\s*$/ | |
end | |
@pm_pages | |
end |
This file contains 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 ParserModule | |
data = nil | |
pages = nil | |
def data=d | |
data = d | |
end | |
def data | |
data |
This file contains 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
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' |
This file contains 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 LawyersController < ApplicationController | |
before_filter :authenticate_user! | |
before_filter :find_lawfirm | |
load_and_authorize_resource | |
layout 'application' | |
This file contains 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
resources :lawfirms, :only => [ :show, :new, :create, :lawyer ] do | |
collection do | |
get :lawyers | |
end | |
end |
This file contains 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
<% 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> |
This file contains 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
@other_things = @thing.other_things.order('created_at ASC') unless @other_things.present? | |
total_count = @other_things.count |
This file contains 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 show | |
begin | |
@company = Company.find params[:id].to_i | |
rescue ActiveRecord::RecordNotFound | |
#do nothing | |
end | |
if @company.present? | |
@vendors = @company.vendors | |
end |
This file contains 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' | |
require 'LoginHelper' | |
require 'rake' | |
describe "Admin User CRUD" do | |
include LoginHelper | |
it 'should list users' do | |
Rake::Task['db:populate'].invoke '10' |
This file contains 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
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 |