Hello everyone, in a test helper in my app I call category.id that gets the id of category in the database. However, when running RSpec I get the following error: As a parla customer /Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: Object#id will be deprecated; use Object#object_id /Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: Object#id will be deprecated; use Object#object_id /Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: Object#id will be deprecated; use Object#object_id /Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: Object#id will be deprecated; use Object#object_id /Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: Object#id will be deprecated; use Object#object_id /Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: Object#id will be deprecated; use Object#object_id I can''t change id method to object_id because they''re totally different things. One is the actual id of the model instance, other is the object_idRuby gives to any of its objects. Does anyone know the solution for this problem? I appreciate your attention and help! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 15, 7:40 pm, Rodrigo Alves Vieira <rodrig...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello everyone, in a test helper in my app I call category.id that gets the > id of category in the database. However, when running RSpec I get the > following error: > > As a parla customer > /Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: > Object#id will be deprecated; use Object#object_id > /Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: > Object#id will be deprecated; use Object#object_id > /Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: > Object#id will be deprecated; use Object#object_id > /Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: > Object#id will be deprecated; use Object#object_id > /Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: > Object#id will be deprecated; use Object#object_id > /Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: > Object#id will be deprecated; use Object#object_id > > I can''t change id method to object_id because they''re totally different > things. One is the actual id of the model instance, other is the object_idRuby gives to any of its objects. > Does anyone know the solution for this problem?This can happen because the object you''re calling id on isn''t what you think it is (eg it''s nil) Fred> > I appreciate your attention and help!-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
On 15 March 2011 19:40, Rodrigo Alves Vieira <rodrigo3n-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello everyone, in a test helper in my app I call category.id that gets the > id of category in the database. However, when running RSpec I get the > following error:It would be worth posting the spec code too. In addition to Fred''s suggestion, I''d wonder whether you might have accidentally used Model.id rather than model.id somewhere... -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Oh yes, actually, this code isn''t a actual spec, it is a file in spec/acceptance/support/paths.rb, there is the code: module NavigationHelpers # Put helper methods related to the paths in your application here. def homepage "/" end def start_order_page "/categories" end def products_page category "/categories/#{category.id}/products" end def new_pizza_page "/pizzas/new" end end RSpec.configuration.include NavigationHelpers, :type => :acceptance please tell me what''s wrong with this, Thanks! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 16 March 2011 00:21, Rodrigo Alves Vieira <rodrigo3n-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Oh yes, actually, this code isn''t a actual spec, it is a file in > spec/acceptance/support/paths.rb, there is the code: > > module NavigationHelpers > def products_page category > "/categories/#{category.id}/products" > end > > please tell me what''s wrong with this,I would be most suspicious of the products_page method... as Fred said, the "category" is likely to be nil. Can you debug at that point? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
I''ll try, in the meantime... won''t this method be deprecated, what''s the appropriate one now? Or maybe I am missing something? Thanks! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 16, 2011, at 1:58 PM, Rodrigo Alves Vieira wrote:> I''ll try, in the meantime... won''t this method be deprecated, what''s > the appropriate one now? > > Or maybe I am missing something? > > Thanks! >Isn''t it supposed to be #instance_id now? Walter -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Oops, problem fixed. Turns out it was what Frederick and pavling pointed out: was calling nil. Thanks everyone, for the responses. And I''ll keep instance_id in mind too, thanks, Walter! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Quoting Rodrigo Alves Vieira <rodrigo3n-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> Hello everyone, in a test helper in my app I call category.id that gets the > id of category in the database. However, when running RSpec I get the > following error: > > As a parla customer > /Users/saulolopes/code/parla/spec/acceptance/support/paths.rb:13: warning: > Object#id will be deprecated; use Object#object_idI use category[:id] instead and it always works as expected. Clumsy, a kludge, but it works. HTH, Jeffrey -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.