Ruby on Rails Sunday, January 1, 2012

On Thu, Dec 29, 2011 at 05:28, Linus Pettersson
<linus.pettersson@gmail.com> wrote:

> def create_permalink
>   self.permalink = "#{self.name} #{self.brand.name}".parameterize
> end
...
> Failure/Error: Factory.create(:product)
> NoMethodError: undefined method `name' for nil:NilClass
>
> Why is that?

My guess would be that you're not setting self.brand. I don't see
anything in the Factory setting it.

-Dave

--
Dave Aronson, President, Dave Aronson Software Engineering and Training
Ruby on Rails Freelancing (Northern Virginia, Washington DC, or Remote)
DaveAronson.com, Codosaur.us, Dare2XL.com, & RecruitingRants.com (NEW!)
Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (me)

--
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@googlegroups.com.
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.

No comments:

Post a Comment