Database rails模型/数据库
我是rails的新手,正在构建一个简单的应用程序Database rails模型/数据库,database,ruby-on-rails-3,Database,Ruby On Rails 3,我是rails的新手,正在构建一个简单的应用程序 用户可以创建一个游戏 用户可以加入由其他用户创建的游戏 目前,我的模型设置如下: 用户-有很多游戏。 游戏-属于用户 第一。在我的帖子里,它很好用 但是我如何才能达到第二名呢 数据库当前如下所示: create_table "games", :force => true do |t| t.integer "user_id" t.datetime "created_at", :null => false t.datetim
create_table "games", :force => true do |t|
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "users", :force => true do |t|
t.string "name"
t.string "email"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
我认为你应该创建一个新的
模型
,名为JoinGame
,它属于
用户
型号
应该是
class用户
class JoinGame
这样你就可以实现你想要的,然后你就必须创建逻辑了我还没有尝试过任何东西,因为我不知道从哪里开始。你没有读过吗?。