This project is archived and is in readonly mode.

#5258 open
Greg Hazel

readonly option

Reported by Greg Hazel | July 30th, 2010 @ 10:28 PM

The readonly feature bites me a lot. It seems that in the common case of a simple join, the models are marked as "readonly?" when in fact they are perfectly suitable for writing. Yes, I know how to force the object to be readable, but in this common case it seems pointless to force me to do that.

Why is this?

>> User.last(:joins => :profile, :conditions => {:profiles => {:gender => "male"}}).readonly?
  User Load (0.5ms)   SELECT `users`.* FROM `users` INNER JOIN `profiles` ON profiles.user_id = users.id WHERE (`profiles`.`gender` = 'male') ORDER BY users.id DESC LIMIT 1
=> true

That select statement seems to return a full, saveable user object. Why is it readonly?

Comments and changes to this ticket

  • Ryan Bigg

    Ryan Bigg October 11th, 2010 @ 02:20 AM

    • Importance changed from “” to “Low”

    If you would like this fixed please submit a patch.

  • Ryan Bigg

    Ryan Bigg October 11th, 2010 @ 02:56 AM

    • Tag cleared.

    Automatic cleanup of spam.

  • Ryan Bigg

    Ryan Bigg October 19th, 2010 @ 08:24 AM

    Automatic cleanup of spam.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:48 PM

    • State changed from “new” to “open”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:48 PM

    • State changed from “open” to “stale”
  • Greg Hazel

    Greg Hazel February 2nd, 2011 @ 07:24 PM

    • State changed from “stale” to “open”

    [state:open]

  • rails

    rails May 3rd, 2011 @ 01:00 AM

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • rails

    rails May 3rd, 2011 @ 01:00 AM

    • State changed from “open” to “stale”
  • Greg Hazel

    Greg Hazel May 3rd, 2011 @ 01:08 AM

    • State changed from “stale” to “open”

    Oh no, not this again.
    [state:open]

  • Brian Racer

    Brian Racer May 7th, 2011 @ 10:38 PM

    This is the intended and documented functionality of :join. If you know you will be modifying the associated model you should use :include instead. I don't think non-readonly functionality logic should be added to :join since there is overhead in instantiating each of the associated models.

  • Greg Hazel

    Greg Hazel May 8th, 2011 @ 01:48 AM

    I'm not talking about the associated models, I'm talking about the primary models.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages