Well, I’ve been slowly starting to use Ruby on Rails over the past
year but obviously haven’t learned very much yet.
I’ve been developing a simple CMS website tool in Ruby (I know, there
are already a lot of CMS tools out there…) but it’s something I’ve
wanted to complete for a while but haven’t got around to it. Anyway,
in this CMS program there are (obviously,) users. Each user has his/
her own “home”. When a user logs into the CMS system they are taken
to their “home” page. On this “home” page there are ideally going to
be a few different lists of things like “recent entries”, “recent
My question is not specifically how to do all of that. But my
question is related more to the design/setup of this type of process.
For example, at the moment I have two major parts to this CMS: “User”
and “Page”. (a Page is like a blog post… web page… etc.) Anyway,
I don’t understand in Ruby on Rails how to communicate between two
classes. For example, I would think my “recent entries” list I
mentioned earlier would go into the Page class… would that go into
the Page.rb model? But I don’t know how to reach that method/function
from the User class.
I’ve been searching for an answer to anything similar to this on RoR
Talk… but I haven’t found what I’m looking for yet. I’ve read on a
lot of posts that it’s good to put functions in Application.rb if you
need them to be accessed by multiple classes. I’m trying to keep each
class as modularized as possible, too. So many questions… I just
don’t understand how best to design something where you need one class
to be able to access another classes’ function and display it later.
Is this something I need to do with a partial?