i am stuck somewhere with The Acrive record association .
whenever i try to get the value from another table it gives me the
foolowing error
"undefined method `journal_name' for nil:NilClass"

MY Controller

def index
@ledgers      =  Ledger.find(:all)
@finaccounts  =  Finaccount.find(:all)
@journels     =  Journel.all
respond_to do |format|
format.html
format.pdf { render :layout => false }
end

view:

    <td><%=h ledger.journel.journal_name %></td>


Models :
 1) Journel

class Journel < ActiveRecord::Base
has_many :ledgers
end

2)

class Ledger < ActiveRecord::Base
belongs_to :journel
end
-- 
Posted via http://www.ruby-forum.com/.

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to