I'm looking to rewrite my project in Rails. It's currently written in PHP (CodeIgniter), I've come to the point where I'm writing more libraries and core extensions than I'm writing new code. I've been looking at some Rails tutorials and I'm liking what I see so far (even though I feel you have less control of what's been passed around). However it seems there's little information out there (maybe I'm not looking in the right places) on database tables without models.
For example, I need a table called user_verification_token
CREATE TABLE IF NOT EXISTS `user_verification_token` (
`user_id` int(11) NOT NULL,
`token` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`is_used` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
It doesn't make sense for me to create a model for this, right?
First question: How do I generate a migration to create a table alone without any model?
Second question: When this table is filled with data, how do I associate with it. e.g. Associate it with the User
model (if possible)/a user object so I can find a user by a token (provided is_used = 0
) and return the user's data?
I apologize in advance if this is a newb question, I can do all these comfortably with PHP but I don't know how to do this on Rails.