Thanks you guys, i've actually tried that(And failed) Perhaps you guys
can help me out.
I have to following files:
card_controller.rb
class CardController < ApplicationController
has_many :cardlevels
has_many :users, :through => :cardlevels
def show
@cards = Card.find(1)
end
end
------------------------------------------------------
cardlevel_controller.rb
class CardlevelController < ApplicationController
belongs_to :users
belongs_to :cards
end
------------------------------------------------------
user_controller.rb
class UserController < ApplicationController
has_many :cardlevels
has_many :cards, :through => :cardlevels
end
------------------------------------------------------
As you can see i'm doing @cards = Card.find(1) in the card_controller.
However i'm getting the error: "undefined method `has_many' for
CardController:Class"
--
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 [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.