I get this error if no relational data is present:
undefined method `notes’ for #Array:0x226cc4c
Here is the code that causes the error:
@notes = @account.notes
If I call this method through the script/console I get
account = Account.find(3)
=> #<Account id: 3, …>
account.notes
=> []
I get the same error if I don’t declare the @notes var and access the
notes collection through the controller within the haml template ie
@account.notes.each do |n| …
I am puzzled.
Thanks for the help