Skip to content

Instantly share code, notes, and snippets.

@sscirrus
Created August 25, 2011 09:47
Show Gist options
  • Save sscirrus/1170338 to your computer and use it in GitHub Desktop.
Save sscirrus/1170338 to your computer and use it in GitHub Desktop.
Starting test server -> Paperclip error
sans-iMac:app san$ rails s -e test
WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.7.3
=> Booting WEBrick
=> Rails 3.0.1 application starting in test on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/san/Documents/san/app/vendor/plugins/paperclip/lib/paperclip.rb:232:in 'has_attached_file': You have a nil object when you didn't expect it! (NoMethodError)
You might have expected an instance of Array.
The error occurred while evaluating nil.[]=
from /Users/san/Documents/san/app/app/models/company.rb:10:in '<class:company>'
from /Users/san/Documents/san/app/app/models/company.rb:1:in '<top (required)>'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in 'require'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in 'block in require'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:227:in 'load_dependency'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in 'require'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:346:in 'require_or_load'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:300:in 'depend_on'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:216:in 'require_dependency'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/engine.rb:138:in 'block (2 levels) in eager_load!'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/engine.rb:137:in 'each'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/engine.rb:137:in 'block in eager_load!'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/engine.rb:135:in 'each'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/engine.rb:135:in 'eager_load!'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/application.rb:108:in 'eager_load!'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/application/finisher.rb:41:in 'block in <module:Finisher>'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/initializable.rb:25:in 'instance_exec'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/initializable.rb:25:in 'run'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/initializable.rb:50:in 'block in run_initializers'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/initializable.rb:49:in 'each'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/initializable.rb:49:in 'run_initializers'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/application.rb:134:in 'initialize!'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/application.rb:77:in 'method_missing'
from /Users/san/Documents/san/app/config/environment.rb:5:in '<top (required)>'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in 'require'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in 'block in require'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:225:in 'block in load_dependency'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:591:in 'new_constants_in'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:225:in 'load_dependency'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in 'require'
from /Users/san/Documents/san/app/config.ru:3:in 'block in <main>'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.3/lib/rack/builder.rb:46:in 'instance_eval'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.3/lib/rack/builder.rb:46:in 'initialize'
from /Users/san/Documents/san/app/config.ru:1:in 'new'
from /Users/san/Documents/san/app/config.ru:1:in '<main>'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.3/lib/rack/builder.rb:35:in 'eval'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.3/lib/rack/builder.rb:35:in 'parse_file'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.3/lib/rack/server.rb:162:in 'app'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.3/lib/rack/server.rb:253:in 'wrapped_app'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.3/lib/rack/server.rb:204:in 'start'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/commands/server.rb:65:in 'start'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/commands.rb:30:in 'block in <top (required)>'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/commands.rb:27:in 'tap'
from /Users/san/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/commands.rb:27:in '<top (required)>'
from script/rails:6:in 'require'
from script/rails:6:in '<main>'
Line 10 of Company.rb:
has_attached_file :attachment,
:storage => :s3,
:s3_credentials => "#{::Rails.root.to_s}/config/s3.yml",
:path => "/candresumes/:style/:id/:normalized_resume_file_name"
Spec_helper.rb
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'paperclip/matchers'
require 'capybara/rspec'
Spec::Runner.configure do |config|
config.include Paperclip::Shoulda::Matchers
end
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
config.mock_with :rspec
config.use_transactional_fixtures = true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment