I want to rewrite my project in Rails. It is currently written in PHP (CodeIgniter), I have come to the conclusion that I am writing more libraries and major extensions than I am writing new code. I studied some of the Rails manuals and I like what I see so far (although I feel that you have less control over what has been transferred). However, it seems that there is little information (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 makes no sense for me to create a model for this, right?
First question . How to create a migration to create a table without any model?
The second question . When this table is populated with data, how can I associate with it. for example, Link it to the User model (if possible) / user object so that I can find the user through the token (provided is_used = 0 ) and return the user data?
I apologize in advance if this is a new question, I can do it all with PHP, but I don't know how to do it on Rails.
source share