ActiveRecord query

Hello,

I am trying to construct an ActiveRecord query to do the following:

I have Tags that have a many-to-many relationship with Ledgers. Many
Ledgers can have many Tags. I want to construct a query to get all the
associated Ledgers that have a particular Tag.

For example, I would like to get all Ledgers with the Tag “Food”. My
database tables are as follows:

Table Ledgers
Table Tags
Table Ledgers_Tags

I also have a Tag Model and a Ledger Model.

How do I construct the query using ActiveRecord?

Never mind. I figured it out:

@ledgers = Label.find_by_id(params[:id]).ledgers

Thanks anyway.