Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6963559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:48:30+00:00 2026-05-27T15:48:30+00:00

Background: I’m building a simple blog using Padrino, Ruby 1.9.2, HAML, and Heroku. I

  • 0

Background: I’m building a simple blog using Padrino, Ruby 1.9.2,
HAML, and Heroku. I want the posts index to have a magazine-like look
to it. For each post in the index, the user should see titles, content
teasers, and images. My problem is with attaching the images.

Problem: I’ve been trying to use the Paperclip gem to attach an image
to each post. Heroku will fish the actual image from an Amazon S3 bin.
So far, when I try to run a migration, I get the error:

$ .../base.rb:1088:in `method_missing': undefined method
`has_attached_file' for #<Class:0xa672140> (NoMethodError)

It looks like Paperclip just won’t load, but there’s where I get
stuck.

Details:
–Q: What am I doing when I “try to run a migration”?
–A: I put the following into the migrations folder

class AddPictureToPost < ActiveRecord::Migration
  def self.up
    change_table :posts do |t|
      t.has_attached_file :picture
    end
  end

  def self.down
    drop_attached_file :posts, :picture
  end
end

then run “padrino rake ar:migrate”

–Q: Do I have Paperclip listed in the Gemfile?
–A: Yes.

–Q: What does the post model look like?
–A:

class Post < ActiveRecord::Base
  has_attached_file :picture,
    :storage => :s3,
    :bucket => 'blog_images',
    :s3_credentials => {
      :access_key_id => ENV['S3_KEY'],
      :secret_access_key => ENV['S3_SECRET']
    }
end

–Q: What does the app.rb look like?
–A:

class Blog < Padrino::Application
  register Padrino::Rendering
  register Padrino::Mailer
  register Padrino::Helpers

  enable :sessions

  get '/' do
    haml :index
  end
end

–Q: What does boot.rb look like?
–A:

PADRINO_ENV  = ENV["PADRINO_ENV"] ||= ENV["RACK_ENV"] ||=
"development"  unless defined?(PADRINO_ENV)
PADRINO_ROOT = File.expand_path('../..', __FILE__) unless defined?
(PADRINO_ROOT)

require 'rubygems' unless defined?(Gem)
require 'bundler/setup'
Bundler.require(:default, PADRINO_ENV)

Padrino.before_load do
end

Padrino.after_load do
end

Padrino.load!

–Q: What does the full error output look like?
–A:

jared:~/blog$ padrino rake ar:migrate
=> Executing Rake ar:migrate ...
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/
active_record/base.rb:1088:in `method_missing': undefined method
`has_attached_file' for #<Class:0xa1ffb30> (NoMethodError)
        from /home/jared/isthmus2/app/models/post.rb:2:in `<class:Post>'
        from /home/jared/isthmus2/app/models/post.rb:1:in `<top (required)>'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `require'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `block in require'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:223:in `block in load_dependency'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:640:in `new_constants_in'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:223:in `load_dependency'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `require'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/reloader.rb:148:in `safe_load'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:162:in `block in require_dependencies'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:160:in `each'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:160:in `require_dependencies'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/application.rb:34:in `inherited'
        from /home/jared/blog/app/app.rb:1:in `<top (required)>'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `require'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `block in require'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:223:in `block in load_dependency'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:640:in `new_constants_in'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:223:in `load_dependency'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `require'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/reloader.rb:148:in `safe_load'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:162:in `block in require_dependencies'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:160:in `each'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:160:in `require_dependencies'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/mounter.rb:148:in `locate_app_object'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/mounter.rb:30:in `initialize'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/mounter.rb:221:in `new'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/mounter.rb:221:in `mount'
        from /home/jared/blog/config/apps.rb:34:in `<top (required)>'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `require'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `block in require'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:223:in `block in load_dependency'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:640:in `new_constants_in'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:223:in `load_dependency'
        from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `require'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/reloader.rb:148:in `safe_load'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:162:in `block in require_dependencies'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:160:in `each'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:160:in `require_dependencies'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:70:in `block in load!'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:70:in `each'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:70:in `load!'
        from /home/jared/blog/config/boot.rb:29:in `<top (required)>'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/cli/base.rb:56:in `require'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/cli/base.rb:56:in `block in rake'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/cli/base.rb:140:in `capture'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/cli/base.rb:56:in `rake'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/task.rb:
22:in `run'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/
invocation.rb:118:in `invoke_task'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor.rb:
263:in `dispatch'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/base.rb:
389:in `start'
        from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/bin/
padrino:9:in `<top (required)>'
        from /usr/local/bin/padrino:19:in `load'
        from /usr/local/bin/padrino:19:in `<main>'

If you’ve read this far…THANKS! I hope you can help me shed some
light on this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:48:31+00:00Added an answer on May 27, 2026 at 3:48 pm

    Paperclip is rails agnostic so you need to put in boot.rb in Padrino.before_load this:

      ActiveRecord::Base.send(:include, Paperclip::Glue)
      File.send(:include, Paperclip::Upfile)
    
      Paperclip.options[:logger] = Padrino.logger
    

    Finally to run migrations under heroku you should run first locally padrino rake gen this will create a Rakefile so you should able to run simply: heroku rake ar:migrate

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background I am writing and using a very simple CGI-based (Perl) content management tool
Background: I am using Eclipse to develop an Android app. I have an xml
Background I have a pair of functions I want to use to animate some
Background: I have a little video playing app with a UI inspired by the
Background: At my company we are developing a bunch applications that are using the
Background I have a massive db for a SharePoint site collection. It is 130GB
Background I am trying to create a copy of a business object I have
Background I have been asked by a client to create a picture of the
Background: I have a css and a js that is used only by the
Background: Sometimes when editing in vim it is possible to have extra characters in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.