Forum: Ruby KirbyBase : update method problem

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
803ad415efcdcbf09b1addeb319650d7?d=identicon&s=25 Adam Akhtar (thegeezer3)
on 2008-11-26 11:49
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 =

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
in `check_against_input_for_specials'
in `each'
in `check_against_input_for_specials'
in `set'
in `each'
in `set'
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?
81b5e41ae80dc7f1aa57d2bf40e7e7d0?d=identicon&s=25 Shawn Anderson (Guest)
on 2008-11-26 18:07
(Received via mailing list)
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.

803ad415efcdcbf09b1addeb319650d7?d=identicon&s=25 Adam Akhtar (thegeezer3)
on 2008-11-27 10:30
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.
This topic is locked and can not be replied to.