Thanks for the response Ashley, I posted canned code just as an
example.
You're right it probably does need .to_s but the point is that id is
nil after saving a new record.
I reckon it should be the id of the new row. (FWIW I'm using merb)
George

On Nov 30, 2:52 pm, Ashley Moran <[email protected]>
wrote:
> On Nov 30, 2009, at 2:33 pm, George wrote:
>
> > def create(thing)
> > �...@thing = Thing.new(thing)
> >  if @thing.save
> >    render @thing.id    # ==> nil
> >  end
> > end
>
> Hi George
>
> Is this Rails?  If so, I'm not sure if Rails' render method is designed to be 
> used this way.  Haven't used Rails for a while, but I found a page[1] that 
> implies you need to do `render :text => @thing.id.to_s`.
>
> Does that help?
>
> Ashley
>
> [1]http://www.rubyonrailsexamples.com/rails-tips/rails-render/
>
> --http://www.patchspace.co.uk/http://www.linkedin.com/in/ashleymoran

--

You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.


Reply via email to