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?
On Thu, Mar 27, 2008 at 2:53 PM, Sean Hussey <seanhus...@gmail.com> wrote:
> 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?
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:
> 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.
> On Thu, Mar 27, 2008 at 2:53 PM, Sean Hussey <seanhus...@gmail.com> wrote:
> > 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?
On Thu, Mar 27, 2008 at 2:59 PM, Sean Hussey <seanhus...@gmail.com> wrote:
> 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: > > 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.
> > On Thu, Mar 27, 2008 at 2:53 PM, Sean Hussey <seanhus...@gmail.com> > wrote:
> > > 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?
> is @news_post.cause nil? that looks like it's the problem.
> On Thu, Mar 27, 2008 at 2:59 PM, Sean Hussey <seanhus...@gmail.com> wrote:
> > 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:
> > > 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.
> > > On Thu, Mar 27, 2008 at 2:53 PM, Sean Hussey <seanhus...@gmail.com>
> > wrote:
> > > > 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?