rubyonrailsin

A Ruby and Rails talk

Tuesday, March 16, 2010


[Rails] Re: SQL result to String conversion

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

Thanks Fred.... when I view d page source.. I see something like this:
Created By (User): #<User:0x1042bbec0>

I guess this is hex representation of the memory point to the following
object <User id: 1, name: "Ron", created_at: "2010-03-15 02:45:28",
> updated_at: "2010-03-15 02:45:28">


Can you please advice me a way to extract just the name from there?


Frederick Cheung wrote:
> On Mar 16, 5:41�pm, Rohit Shinde <li...@ruby-forum.com> wrote:
>>
>> Now, when I run the server; the above line of code displays just the '#'
>> symbol.. nothing else (no name is displayed :-( ):
>> Created By (User): #
>>
>
> That's because all that is being stuck in the view is something like
>
> #<User id: 1, name: "Ron", created_at: "2010-03-15 02:45:28",
> updated_at: "2010-03-15 02:45:28">
>
> Which isn't legal html (you can verify this by viewing the html source
> in your browser)
>
> Fred

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive