Re: [Rails] Re: accessing the field of a model that belongs to another model using dot notation

2011-02-25 Thread Michael Pavling
On 25 February 2011 19:28, John Merlino wrote: > post.blog_images.first.image_file_name > > outputs > > undefined method `image_file_name' for nil:NilClass That means that in your chain of method calls, the thing before "image_file_name" is nil. So there is no "first" record in the blog_images co

Re: [Rails] Re: accessing the field of a model that belongs to another model using dot notation

2011-02-25 Thread Hassan Schroeder
On Fri, Feb 25, 2011 at 11:28 AM, John Merlino wrote: > post.blog_images.first.image_file_name > > outputs > > undefined method `image_file_name' for nil:NilClass > > I think that means I called a method on a class that it cannot find? It means that this particular 'post' has no 'blog_images' as

[Rails] Re: accessing the field of a model that belongs to another model using dot notation

2011-02-25 Thread John Merlino
Thanks for replies. This: post.blog_images.first.image_file_name outputs undefined method `image_file_name' for nil:NilClass I think that means I called a method on a class that it cannot find? I have already established has_many belongs_to between blog_images and posts table. This doesn't