Issue
I have created a migration file as follows before generating a model , viewer or a controller
class Papaers < ActiveRecord::Migration
def self.up
create_table :papers do |t|
t.integer :unit_id, :null=>false
t.integer :document_id, :null=>false
t.timestamps
end
end
def self.down
drop_table :papers
end
end
This ran well and it create the table. But now I want to create a model for this table. Is there a way in rails to create a model after running migration files? I could not see any model generated under papers in model.
Solution
rails g model Papaers --migration=false
Or you can also give
rails g model Papaers
Rails generator would not overwrite if migration already exists.
Answered By - Siva Answer Checked By - Cary Denson (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.