On Oct 23, 3:56 pm, Aljaz Fajmut <[email protected]>
wrote:
> Hello.
>
> How do I access blog object/model from the following active record
> class:
>
> class Entry < ActiveRecord::Base
>
>   belongs_to :blog
>
>   def self.test
>     puts blog.title
>   end
> end

Don't make test a class method  - individual instances of Entry have
an associated blog, not the class as a whole.

Fred
>
> In the example above I want to print the blog title.
>
> Thanks for help!
> --
> Posted viahttp://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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to