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 7404635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:16:57+00:00 2026-05-29T05:16:57+00:00

I have a user model that is generated using Devise. I am extending this

  • 0

I have a user model that is generated using Devise. I am extending this model using paperclip to enable file upload and also the processing of a file using a custom paperclip processor.

My paperclip field is declared in the user model as follows. PaperClipStorage is a hash that I create with the paperclip variables. Also, the being stored on AWS S3.

has_attached_file :rb_resume, PaperclipStorageHash.merge(:style => { :contents => 'resume_contents'}, :processors => [:resume_builder])
validates_attachment_content_type :rb_resume, :if => lambda { |x| x.rb_resume? }, :content_type => ['application/pdf', 'application/x-pdf', 'application/msword', 'application/x-doc']

The validates_attachment_content_type check is being done to make sure that it only processes pdf and MS word files.

My processor looks as follows

module Paperclip
  class ResumeBuilder < Processor
    def initialize(file,options = {}, attachment = nil)
      @file = file
      @attachment = attachment
      puts "Attachment is not null " if !attachment.nil?
    end

    def make
      rb = MyModule::MyClass.new(@file.path) ### Do something with the file
      section_layout  = rb.parse_html
      @attachment.instance_write(:whiny, section_layout)
      @file
    end
  end
end

In my user model I also have an after_save callback that is supposed to take the section_layout generated in the processors make method. Code is as follows

after_save :save_sections
def save_sections
   section_layout = rb_resume.instance_read(:whiny)
   # Do something with section_layout...
end

Now my problem is that the processor code is never being called, and I can’t figure out why.

Because of that the section_layout variable is always nil.

Another point to note is that the same model also has two other has_attached_file attributes. None of the other two use a custom processor.

I’ve been struggling with this for last 3 hours. Any help would be greatly appreciate.

Thanks

Paul

  • 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-29T05:16:58+00:00Added an answer on May 29, 2026 at 5:16 am

    Error in my has_attached_file declaration

    has_attached_file :rb_resume, PaperclipStorageHash.merge(:style => { :contents => 'resume_contents'}, :processors => [:resume_builder])
    

    should actually be

    has_attached_file :rb_resume, PaperclipStorageHash.merge(:styles => { :contents => 'resume_contents'}, :processors => [:resume_builder])
    

    Notice the plural styles as opposed to singular style

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

Sidebar

Related Questions

I have a model that holds user address. This model has to have first_name
I have a User model that Devise manages - i.e. all users have email
I have a user model that requires the user to change their password every
So I have a User model that :has_many other models like Documents, Videos, Posts
I have a model that has a ForeignKey to the built-in user model in
I have a user model on which I check to make sure that the
I have a data model that includes common columns like addedBy, editedby (user), addedDate,
In my CakePHP 1.2.5 app, I have a Profile model that belongsTo a User
Say I have a model called User that has the following parameters: favorite_color, favorite_animal,
I have a very simple issue: User model: class User < ActiveRecord::Base devise :database_authenticatable,

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.