3 Replies - 2498 Views - Last Post: 18 April 2012 - 12:50 PM Rate Topic: -----

#1 rvbsanjose  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 17-October 11

First day with ruby and rails... rails appending some weird text

Posted 18 April 2012 - 10:52 AM

Hey community,

It's my first day with ruby and rails. I figured the best way to learn this framework and language is to go ahead and create my idea using this framework. I think this is the best way for me to learn. I'm noticing at the end of my page, rails is printing the below to the screen before my pagination links. Any ideas why this is happening?

#<Post:0x10420f788>#<Post:0x10420f260>#<Post:0x10420ec20>

Is This A Good Question/Topic? 0
  • +

Replies To: First day with ruby and rails... rails appending some weird text

#2 xclite  Icon User is offline

  • LIKE A BOSS
  • member icon


Reputation: 894
  • View blog
  • Posts: 3,153
  • Joined: 12-May 09

Re: First day with ruby and rails... rails appending some weird text

Posted 18 April 2012 - 10:54 AM

That looks like the result of printing an object without getting a string representation - I'm not too familiar with rails but I'd look around for places that unintentionally output Post objects, or that should be outputting an attribute of them rather than the whole thing.
Was This Post Helpful? 0
  • +
  • -

#3 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2089
  • View blog
  • Posts: 3,182
  • Joined: 21-June 11

Re: First day with ruby and rails... rails appending some weird text

Posted 18 April 2012 - 12:20 PM

My guess is you used <%= some place where you intended to use <% (and the block inside the <%= %> then returns a Post object which is unintentionally written to the page). For more information you'd have to show us the code of the view that produces that output.
Was This Post Helpful? 4
  • +
  • -

#4 rvbsanjose  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 17-October 11

Re: First day with ruby and rails... rails appending some weird text

Posted 18 April 2012 - 12:50 PM

View Postsepp2k, on 18 April 2012 - 11:20 AM, said:

My guess is you used <%= some place where you intended to use <% (and the block inside the <%= %> then returns a Post object which is unintentionally written to the page). For more information you'd have to show us the code of the view that produces that output.


You were ABSOLUTELY correct! It was starting to drive me nuts! I had a <%= @p.each do |x| %> which was causing the problems. Thanks so much!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1