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

  • Home
  • SEARCH
  • 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 6667287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:55:02+00:00 2026-05-26T02:55:02+00:00

EDIT – ‘carrierwave’ doesn’t work with Sinatra 1.3. Sinatra 1.2.7 rocks this code! I’m

  • 0

EDIT – ‘carrierwave’ doesn’t work with Sinatra 1.3.
Sinatra 1.2.7 rocks this code!


I’m learning Ruby, and just finished this awesome Sinatra tutorial:
http://net.tutsplus.com/tutorials/ruby/singing-with-sinatra-the-encore/

The complete, working code is here (no Bundler, so requires a couple gems to be installed)
http://nettuts.s3.amazonaws.com/953_sinatra3/Source.zip

I feel good, I want to learn more! The next challenge I’ve set for myself is to add file uploading capability to that tutorial, and I’m stumped. I want to use Carrierwave, and am attempting to integrate it into the completed tutorial.

First, I’m requiring ‘carrierwave’ and ‘carrierwave-datamapper’:

require 'carrierwave'
require 'carrierwave/datamapper'

Then I’m creating a new class:

class MyUploader < CarrierWave::Uploader::Base    #via a Carrierwave tutorial
  storage :file
end

Adding to the Notes class:

class Note
include DataMapper::Resource
property :id, Serial
property :content, Text, :required => true
property :complete, Boolean, :required => true, :default => 0
property :created_at, DateTime
property :updated_at, DateTime
property :image, String, :auto_validation => false  # trying to add image uploading
mount_uploader :image, MyUploader                   # trying to add image uploading
end

Adding to post:

post '/' do
  n = Note.new
  n.content = params[:content]
  n.image = params[:image]      # trying to add image uploading
  n.created_at = Time.now
  n.updated_at = Time.now
  n.upload = 
  if n.save 
    redirect '/', :notice => 'Note created successfully.'
  else
    redirect '/', :error => 'Failed to save note.'
  end
end

Lastly, I’m adding uploading to the form:

<section id="add">
<form action="/" method="post" enctype="multipart/form-data">
    <textarea name="content" placeholder="Your note&hellip;"></textarea>
    <p><input type="file" name="image" /></p>
    <input type="submit" value="Take Note!">
</form>
</section>

I’m getting this error:

/gems/carrierwave-0.5.7/lib/carrierwave.rb:107:in `<top (required)>': private method `public' called for Sinatra::Application:Class (NoMethodError)

But of course if I don’t require ‘carrierwave’, I get an error when MyUploader tries to inherit from it…

Thanks in advance for any tips. I feel so close here, and yet so far!

  • 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-26T02:55:02+00:00Added an answer on May 26, 2026 at 2:55 am

    This error looks like it’s caused by a recent change to sinatra. This is in the changelog for version 1.3:

    Renamed :public to :public_folder to avoid overriding Ruby’s built-in public method/keyword. set(:public, ...) is still possible but shows a warning. (Konstantin Haase)

    Either check if there’s a more recent version of carrierwave or use a previous version of sinatra.

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

Sidebar

Related Questions

Edit: This was accidentally posted twice. Original: VB.NET Importing Classes I've seen some code
EDIT: People keep visiting this post which doesn't have much good information so I'll
Edit: This question was written in 2008, which was like 3 internet ages ago.
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: This question is more about language engineering than C++ itself. I used C++
Edit: I have solved this by myself. See my answer below I have set
EDIT: For anyone coming to this question through searching, you can install a Gnome
Edit: I'm well aware of that this works very well with value types, my
EDIT:This did it: SELECT DISTINCT profileid FROM profilesrelevation WHERE profileid NOT IN ( SELECT
Edit: Updating post based on Martins comments below Hello, I'm just trying to get

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.