------art_34769_28029101.1133807885223
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Actually, your information is a bit off-center.  Although yes, the current
versions of ruby do warn about use of object#id being deprecated, the #id
method for ActiveRecord objects is actually a reference to the unique value
for the given row of the database...

When used in link_to statement within rails the :id => item syntax simply
assigns the unique id of the record to a hidden form element under the name
"id" .

So, I hope that helps provide context.  The above code ( and/or the code
from my previous posting ) has/have absolutely NOTHING to do with ruby's
object#id.

Hope that helps clear things up, because use of the two ( ActiveRecord#id
vs. Object#id ) are quite 180 from each other.

j.

On 12/5/05, Mike Fletcher <lemurific+rforum / gmail.com> wrote:
>
> stevanicus wrote:
> > <% @tasklists.each do |tasklist| %>
> > <%= check_box("task", "done") %>
> > <%= tasklist.task %>
> > <%= link_to("Edit", :action => "edit", :id => @tasklists.id) %>
> > <br />
> > <%end%>
>
>
> What you've done (just to expand on *why* it doesn't work) is you've
> called the "id" method on @tasklists which is an Array instance, not an
> Active::Record descended model object.  So it's returning the unique
> Object#object_id instead of a database record id (which is why your
> error message says "29134536" instead of "1").  In fact if you look at
> your logs you'll probably see a gripe that Object#id is deprecated and
> you should use Object#object_id instead.
>
> $ ruby -le 'puts Array.new().id'
> -e:1: warning: Object#id will be deprecated; use Object#object_id
> 941526
>
> As you can see that number's not going to be anywhere near what your
> valid record ids are.
>
> What you want to do is pass the AR instance to link_to, or call the id
> method on that instead (which link_to does behind the scenes if passed
> an object which implements "id"; your problem was that while Array can
> do id it's not the right id method).
>
> --
> Posted via http://www.ruby-forum.com/.
>
>


--
"Remember. Understand. Believe. Yield! -> http://ruby-lang.org"

Jeff Wood

------art_34769_28029101.1133807885223--