Google Groups Home
Help | Sign in
30 errors with should_be_restful
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Sean Hussey  
View profile
 More options Mar 27, 2:53 pm
From: Sean Hussey <seanhus...@gmail.com>
Date: Thu, 27 Mar 2008 11:53:09 -0700 (PDT)
Local: Thurs, Mar 27 2008 2:53 pm
Subject: 30 errors with should_be_restful
Hi everyone,

I'm using resource_controller, which I hope isn't causing this issue.

A sampling of some of the test errors:

test: on PUT to :update with {} should not have errors on @news_post.
(NewsPostsontrollerTest):
RuntimeError: Called id for nil, which would mistakenly be 4  (etc...)

They're all like that.

My test (in setup @news_post = news_posts :one):

should_be_restful do |resource|
  resource.klass = NewsPost  # Tried without this, same result.
  resource.object = :news_post  # Tried without this, same result.
  resource.parent = :cause
  resource.formats = [:html]
end

Cause has_many :news_posts and NewsPost belongs_to :cause.

Routing:

map.resources :causes, :has_many => :news_posts  # Also tried with
normal do block, same result.

I have another parent/child relationship with members and memberships
that works fine in tests.  I can't see any differences in the two
approaches.  Any ideas?

Thanks!

Sean


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Golick  
View profile
 More options Mar 27, 2:55 pm
From: "James Golick" <jamesgol...@gmail.com>
Date: Thu, 27 Mar 2008 14:55:12 -0400
Local: Thurs, Mar 27 2008 2:55 pm
Subject: Re: 30 errors with should_be_restful

Can you pastie the backtrace pls. This combination (r_c & shoulda) is my
toolset for nearly every project I work on, so I'm pretty sure I can help.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sean Hussey  
View profile
 More options Mar 27, 2:59 pm
From: Sean Hussey <seanhus...@gmail.com>
Date: Thu, 27 Mar 2008 11:59:17 -0700 (PDT)
Local: Thurs, Mar 27 2008 2:59 pm
Subject: Re: 30 errors with should_be_restful
Here's a few:

 17) Error:
test: on GET to :new should render 'new' template.
(NewsPostsControllerTest):
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you
really wanted the id of nil, use object_id
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/controller_tests/controller_tests.rb:458:in
`make_parent_params'
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/controller_tests/formats/html.rb:83:in
`__bind_1206644279_40486'
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/gem/shoulda.rb:101:in `call'
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/gem/shoulda.rb:101:in `test: on GET to :new should render
'new' template. '
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/gem/shoulda.rb:101:in `each'
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/gem/shoulda.rb:101:in `test: on GET to :new should render
'new' template. '

 25) Error:
test: on POST to :create with {} should not have errors on @news_post.
(NewsPostsControllerTest):
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you
really wanted the id of nil, use object_id
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/controller_tests/controller_tests.rb:458:in
`make_parent_params'
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/controller_tests/formats/html.rb:137:in
`__bind_1206644279_51048'
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/gem/shoulda.rb:101:in `call'
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/gem/shoulda.rb:101:in `test: on POST to :create with {} should
not have errors on @news_post. '
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/gem/shoulda.rb:101:in `each'
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/gem/shoulda.rb:101:in `test: on POST to :create with {} should
not have errors on @news_post. '

 30) Error:
test: on PUT to :update with {} should redirect to
"cause_news_post_url(@news_post.cause, @news_post)".
(NewsPostsControllerTest):
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you
really wanted the id of nil, use object_id
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/controller_tests/controller_tests.rb:458:in
`make_parent_params'
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/controller_tests/formats/html.rb:170:in
`__bind_1206644279_57644'
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/gem/shoulda.rb:101:in `call'
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/gem/shoulda.rb:101:in `test: on PUT to :update with {} should
redirect to "cause_news_post_url(@news_post.cause, @news_post)". '
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/gem/shoulda.rb:101:in `each'
    /Users/sean/Projects/Rails/onecause/vendor/plugins/shoulda/lib/
shoulda/gem/shoulda.rb:101:in `test: on PUT to :update with {} should
redirect to "cause_news_post_url(@news_post.cause, @news_post)". '

On Mar 27, 2:55 pm, "James Golick" <jamesgol...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Golick  
View profile
 More options Mar 27, 3:00 pm
From: "James Golick" <jamesgol...@gmail.com>
Date: Thu, 27 Mar 2008 15:00:55 -0400
Local: Thurs, Mar 27 2008 3:00 pm
Subject: Re: 30 errors with should_be_restful

is @news_post.cause nil? that looks like it's the problem.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sean Hussey  
View profile
 More options Mar 27, 3:07 pm
From: Sean Hussey <seanhus...@gmail.com>
Date: Thu, 27 Mar 2008 12:07:44 -0700 (PDT)
Local: Thurs, Mar 27 2008 3:07 pm
Subject: Re: 30 errors with should_be_restful
Ugh, sorta, kinda, not really.  The fixtures were set up with cause: 1
instead of cause_id: 1.

Thanks for the help!

Sean

On Mar 27, 3:00 pm, "James Golick" <jamesgol...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google