# KirbyBase : update method problem

**URL:** <https://www.ruby-forum.com/t/kirbybase-update-method-problem/154202>\
**Category:** Ruby\
**Created:** [November 26, 2008, 11:49am UTC](https://www.ruby-forum.com/t/kirbybase-update-method-problem/154202 "2008-11-26T11:49:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [November 26, 2008, 11:49am UTC](https://www.ruby-forum.com/t/kirbybase-update-method-problem/154202/1 "2008-11-26T11:49:55Z")

</div>

## the basic code below makes kirby complain that im trying to update a link\_to many field in my table when as can be seen I am not. Here is some code for you to copy into irb to reproduce the error (though the problem lies with only the pt table i have also included the code to create the table its linked to called tt). I have read the manual many times to no avail. I also looked through kirbys code but im a beginner and i got lost in it 😉

require ‘kirbybase’

db = KirbyBase.new

db.drop\_table(:pt) if db.table\_exists?(:pt)  
db.drop\_table(:tt) if db.table\_exists?(:tt)

tt = db.create\_table(:tt, :task\_title, {:DataType=\>:String,  
:Default=\>‘No Title’}, :completed, {:DataType=\>:Boolean,  
:Default=\>true}, :project, {:DataType=\>:String,  
:Default=\>‘None’},:p\_project\_id, :Integer)

pt = db.create\_table(:pt, :project\_title, {:DataType=\>:String,  
:Default=\>‘No Project Name’}, :p\_project\_id, {:DataType=\>:Integer,  
:Default=\>0}, :p\_tasks,{:DataType=\>:ResultSet,  
:Link\_many=\>[:p\_project\_id, :task\_table, :p\_project\_id]})

pt.insert(:project\_title =\> “old”) #creates record with recno = 1  
pt.update(:project\_title =\> “new”) {|r| r.recno == 1}

* * *

here is my error - p\_tasks is the linked item in the other table tt.

ArgumentError: You cannot input a value for this field: p\_tasks  
from  
c:/ruby/lib/ruby/gems/1.8/gems/KirbyBase-2.6/lib/kirbybase.rb:3079:  
in `check_against_input_for_specials' from c:/ruby/lib/ruby/gems/1.8/gems/KirbyBase-2.6/lib/kirbybase.rb:3078: in`each’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/KirbyBase-2.6/lib/kirbybase.rb:3078:  
in `check_against_input_for_specials' from c:/ruby/lib/ruby/gems/1.8/gems/KirbyBase-2.6/lib/kirbybase.rb:2283: in`set’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/KirbyBase-2.6/lib/kirbybase.rb:2256:  
in `each' from c:/ruby/lib/ruby/gems/1.8/gems/KirbyBase-2.6/lib/kirbybase.rb:2256: in`set’  
from  
c:/ruby/lib/ruby/gems/1.8/gems/KirbyBase-2.6/lib/kirbybase.rb:2220:  
in `update’  
from (irb):72  
from :0

* * *

in case your wondering, tt is a tasks table and pt is a projects table.  
This is for a simple todo list app. Projects are comprised of tasks  
hence the link.

Can anyone help?

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [November 26, 2008, 6:07pm UTC](https://www.ruby-forum.com/t/kirbybase-update-method-problem/154202/2 "2008-11-26T18:07:03Z")

</div>

This should work:  
pt.update(:project\_title =\> “new”,:p\_tasks=\>nil) {|r| r.recno == 1}

not sure if that’s what you were shooting for, and I’m not sure why that  
doesn’t work the way you were doing it.  
I’ll try to look at it some more today.

/Shawn

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [November 27, 2008, 10:30am UTC](https://www.ruby-forum.com/t/kirbybase-update-method-problem/154202/3 "2008-11-27T10:30:55Z")

</div>

hey shawn, thanks for that, it does work with the short snippet above,  
ive yet to try it with my project though. Im wondering if this is whats  
intended by the author and its simply not been updated in the docs or if  
its a coding error.
