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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:15:58+00:00 2026-05-25T12:15:58+00:00

ActiveRecord proxy_owner is now deprecated and the explanation here is very vague on how

  • 0

ActiveRecord proxy_owner is now deprecated and the explanation here is very vague on how to change it, so I’m not sure how to use it my case:
http://apidock.com/rails/ActiveRecord/Associations/AssociationProxy

Here is what I’m trying to do:

class Library < ActiveRecord::Base
  has_many :books do
    def some_method
      proxy_owner.author
    end
  end
end

I get a warning when I run this code that proxy_owner is deprecated:

DEPRECATION WARNING: Calling record.books.proxy_owner is deprecated. Please use record.association(:books).owner instead.

I can replace proxy_owner.author with:

@associaton.owner.author

This works; however, it seems dangerous. Am I missing something here?

  • 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-25T12:15:58+00:00Added an answer on May 25, 2026 at 12:15 pm

    I think it’s safer to send :owner to proxy_association instead:

    class Library < ActiveRecord::Base
      has_many :books do
        def some_method
          proxy_association.owner.author
        end
      end
    end
    

    The use of proxy_association is now mentioned in the documentation:

    However, inside the actual extension code, you will not have access to
    the record (record.association(:items).owner) as above. In this case, you can access proxy_association.
    For example, record.association(:items) and
    record.items.proxy_association will return the same object, allowing
    you to make calls like proxy_association.owner inside association
    extensions.

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

Sidebar

Related Questions

I'm not sure what's going on here. Using MiniMagick 3.3, everything was working fine
Throwing ActiveRecord::Rollback works, but not in tests. I've had this problem before, am now
How do i use ActiveRecord on existing DB with multiple columns as primary key
Checked ActiveRecord, DataMapper, Sequel: some use globals (static variables) some require open db connection
Using ActiveRecord::Base.to_json I do: user = User.find_by_name 'Mika' {created_at:2011-07-10T11:30:49+03:00,id:5,is_deleted:null,name:Mika} Now, what I would like
How do I configure ActiveRecord to use partial_updates in a Padrino application? Customer <
ActiveRecord use to call after_save callback each time save method is called even if
Here is query: ActiveRecord::StatementInvalid (PGError: ERROR: syntax error at or near over select *,
In Rails while using activeRecord why are join queries considered bad. For example Here
Single Table Inheritance using ActiveRecord. Since we can use @test = Employee.all and find

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.