Adil
Adil

Reputation: 582

Rails custom queries without using models

Recently I've been developing a simple website as a learning process, and I've come across a problem. I've separated out the database into two tables, a 'user' tables, and a 'character' table. The problem I'm facing is I need to select all the user's characters from the character table without creating any models for the character (as that's handled elsewhere). Is there any way I could go about solving this?

I do also have a table which has three columns; "id", "user_id", and "character_id"

Help is appreciated!

Thanks, Adil

Upvotes: 0

Views: 647

Answers (1)

Erez Rabih
Erez Rabih

Reputation: 15788

You can use ActiveRecord::Base.connection.execute("some sql query here")

Upvotes: 2

Related Questions