Say I have table with the following columns:
class CreatePosts < ActiveRecord::Migration
def change
drop_table :posts
create_table :posts do |t|
t.string :First_Name
t.string :Last_Name
t.string :Company
t.timestamps
end
end
end
I've been lookin up gems such as faker, Randexp, foregery. But how exactly will the data be imported into the database, So far I've only played around things that go into the database via a form.
I'm assuming it is done through the controller:
def create
@post = Post.new(post_params)
@post.save
redirect_to @post
end
But not sure how exactly, any examples or hints to guide me through this? Thanks