Reputation: 1044
I'm stuck in this scenario:
I've a table(it is not a model)
and want to insert data in it via Rails
.
For example:
Table name: Last updates
fields: another_table_id:integer, last_time:datetime
I want to insert data into this?
Upvotes: 0
Views: 67
Reputation: 1044
I got the answer,
connection = ActiveRecord::Base.connection
ActiveRecord::Base.connection.execute("SQL query")
we can perform any query in Rails.
Upvotes: 1