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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:58:56+00:00 2026-06-07T03:58:56+00:00

I have a Model like so: # == Schema Information # # Table name:

  • 0

I have a Model like so:

# == Schema Information
#
# Table name: s3_files
#
#  id                       :integer         not null, primary key
#  owner                    :string(255)
#  notes                    :text
#  created_at               :datetime        not null
#  updated_at               :datetime        not null
#  last_accessed_by_user    :string(255)
#  last_accessed_time_stamp :datetime
#  upload_file_name         :string(255)
#  upload_content_type      :string(255)
#  upload_file_size         :integer
#  upload_updated_at        :datetime
#

class S3File < ActiveRecord::Base

  #PaperClip methods
  attr_accessible :upload
  attr_accessor :owner

  Paperclip.interpolates :prefix  do |attachment, style|
    I WOULD LIKE TO ACCESS VARIABLE= owner HERE- HOW TO DO THAT?

  end

  has_attached_file(  :upload,
                  :path => ":prefix/:basename.:extension",
                  :storage => :s3,
                  :s3_credentials => {:access_key_id => "ZXXX",
                                      :secret_access_key => "XXX"},
                  :bucket => "XXX"
                )


  #Used to connect to users through the join table
  has_many :user_resource_relationships
  has_many :users, :through => :user_resource_relationships

 end

Im setting this variable in the controller like so:

    # POST /s3_files
    # POST /s3_files.json
   def create
    @s3_file = S3File.new(params[:s3_file])
    @s3_file.owner = current_user.email

    respond_to do |format|
      if @s3_file.save
        format.html { redirect_to @s3_file, notice: 'S3 file was successfully created.' }
        format.json { render json: @s3_file, status: :created, location: @s3_file }
      else
        format.html { render action: "new" }
        format.json { render json: @s3_file.errors, status: :unprocessable_entity }
      end
    end
  end

Thanks, any help would be appreciated.

  • 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-06-07T03:58:58+00:00Added an answer on June 7, 2026 at 3:58 am

    Just use owner or self.owner to get at the variable

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

Sidebar

Related Questions

I have a simple model like this one: class Artist(models.Model): surname = models.CharField(max_length=200) name
I have a model.py like this: class EventTypeCategory(models.Model): name = models.CharField(max_length=50, verbose_name=Name) user =
some methods in our model pojos have been annotated like this: @Column(name=cli_clipping_id, updatable=false, columnDefinition
I have model like this: scope :search_posts, lambda { |query| mega_posts.where( title LIKE ?
I have a model like: CAMPAIGN_TYPES = ( ('email','Email'), ('display','Display'), ('search','Search'), ) class Campaign(models.Model):
I have entity model like this (using EclipseLink and JPA 2.0): @Entity class A
I have a model like the following one: public class TestModel{ public IList<Field> Fields
I'm using MVC3 and I have a model like this: public class Foo {
I have a model class like this: class Note(models.Model): author = models.ForeignKey(User, related_name='notes') content
I'm using Doctrine ODM with MongoDB. I have a product model like this: namespace

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.