On Mon, Aug 2, 2010 at 2:26 PM, wprater <[email protected]> wrote:
> Here is my model and an attempt to convert to json. Whether there is > data returned or not, a circular reference error is thrown. How can I > avoid this? > > wprater, I would recommend trying Rails 3 RC by doing the following: gem install rails --pre Also, if you don't have a requirement to use Ruby 1.8.7, I would recommend using Ruby 1.9.2 RC2 by doing the following: rvm install 1.9.2 Ryan Bates recently added the following screencast which covers the installation of both Rails 3 and Ruby 1.9.2. http://media.railscasts.com/videos/225_upgrading_to_rails_3_part_1.mov Good luck, -Conrad > > ruby-1.8.7-p249 > PayPeriod > => PayPeriod(id: integer, start_date: date, end_date: date, pay_date: > date) > ruby-1.8.7-p249 > PayPeriod.where('end_date < ?', Time.now) > => [] > ruby-1.8.7-p249 > PayPeriod.where('end_date < ?', Time.now).to_json > ActiveSupport::JSON::Encoding::CircularReferenceError: object > references itself > from /Users/wprater/.rvm/gems/ruby-1.8.7-p249/gems/ > activesupport-3.0.0.beta4/lib/active_support/json/encoding.rb:59:in > `check_for_circular_references' > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]<rubyonrails-talk%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

