I want to use several custom classes in the controller. Some of them
are supposed to have certain associations. I know how to work with
associations in the model and I thought that I could do something
similar here.
What I tried is something like this:
module Types
class System < ActiveRecord::Base
has_many :resources
attr_accessor :name
def initialize(name)
@name = name
end
end
class Resource < ActiveRecord::Base
belongs_to :system
attr_accessor :name
def initialize(name,system)
@name = name
# add to system (?)
end
end
end
So how can I specity the System for a Resource or return it?
Thanks,
Max