# Why is my record readonly=\>true?

**URL:** <https://www.ruby-forum.com/t/why-is-my-record-readonly-true/60336>\
**Category:** Rails\
**Created:** [January 8, 2006, 7:49pm UTC](https://www.ruby-forum.com/t/why-is-my-record-readonly-true/60336 "2006-01-08T19:49:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brucebalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@brucebalmer](https://www.ruby-forum.com/u/brucebalmer)\
**Post date:** [January 8, 2006, 7:49pm UTC](https://www.ruby-forum.com/t/why-is-my-record-readonly-true/60336/1 "2006-01-08T19:49:51Z")

</div>

Hello:

I have something very order to create my object

def review  
@bit = Bit.find(:first,  
:select =\> “bits.\*,subjects.id as sid,  
subjects.name,gaps.id as gid, gaps.gap”,  
:joins =\> “left join (subjects,gaps) on  
(bits.subject\_id = subjects.id and bits.gap\_id = gaps.id)”,  
:conditions =\> “bits.status=‘a’ and  
next\_review \<= CURDATE()”,  
:order =\> “gap,next\_review,subject\_id,bits.id”)  
end

But when I try to save it rails complains that it is read-only. this  
is true, I can see that from the @bit.inspect I put in my view. But  
what is the cause?

Any help, much appreciated.

bruce

---

<div class="post-metadata">

**Author:** ![brucebalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@brucebalmer](https://www.ruby-forum.com/u/brucebalmer)\
**Post date:** [January 8, 2006, 7:55pm UTC](https://www.ruby-forum.com/t/why-is-my-record-readonly-true/60336/2 "2006-01-08T19:55:35Z")

</div>

> But when I try to save it rails complains that it is read-only. this  
> is true, I can see that from the @bit.inspect I put in my view. But  
> what is the cause?

From the ‘find’ RDocs

":joins: An SQL fragment for additional joins like “LEFT JOIN comments  
ON comments.post\_id = id”. (Rarely needed). The records will be returned  
read-only since they will have attributes that do not correspond to the  
tableâ??s columns. Pass :readonly =\> false to override. "

---

<div class="post-metadata">

**Author:** ![brucebalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@brucebalmer](https://www.ruby-forum.com/u/brucebalmer)\
**Post date:** [January 8, 2006, 8:13pm UTC](https://www.ruby-forum.com/t/why-is-my-record-readonly-true/60336/3 "2006-01-08T20:13:57Z")

</div>

Kevin:

Thank you. that got it working.

bruce
