Adding record in database table

I have a question that Is it possible to add record into the database
table without adding the model for that?

E.g. I have a table customers. And I haven't created a model for that.
Can I add a record into that table bu doing ""

Any help appreciated.

You can't do unless the Customer class is defined.
Otherwise how would ruby know what to do?
All you need is models/customer.rb containing

class Customer < ActiveRecord::Base

Provided the customer table meets the normal Rails conventions
(primary key id and so on).


If you don't want to create a model you can use straight SQL with
ActiveRecord::Base.connection.execute. I would create the model,
though. It would be the hell of a lot simpler and cleaner.

The model was used for controller connected database.Otherwise, you can
use straight SQL with ActiveRecord::Base.connection.execute.I would like to use model