I would probably have a has_one -> belongs_to between users and subscriptions. The Subscription has many attributes that can change a lot over time and when designing anything one of the first questions you should ask is, "what is going to change over time?"
You could then make a subscribed?
method on the user for syntactic sugar
class User < ActiveRecord::Base
has_one :subscription
def subscribed?
subscription.present?
end
end
class Subscription < ActiveRecord::Base
belongs_to :user
end
You'll want to have a column in your subscription table for user_id
so you can use the association properly.
In addition, in the migration, you can add this column by using belongs_to
(if you're on a newer version of Rails:
create_table :subscriptions do |t|
t.belongs_to :user
t.string :account_id
t.timestamps
end
If you have everything set up right, then this should work in the rails console
:
User.first.subscription # => Subscription<>
Subscription.first.user # => User <>