ckdake / setler

Setler lets you use the 'Feature Flags' pattern or add settings to models in Rails
MIT License
84 stars 21 forks source link

README typo? #13

Closed srbiv closed 10 years ago

srbiv commented 12 years ago

Should

class User < ActiveRecord::Base
  has_setler as: :settings
end

Really be:

class User < ActiveRecord::Base
  has_setler :settings
end

?

stevenharman commented 12 years ago

The current implementation sure doesn't support that: https://github.com/ckdake/setler/blob/master/lib/setler/active_record.rb#L4

However, I think it should. It seems in the past Setler was hardcoded to use a Settings table and ActiveRecord model, but now you'd need a disperate model for each named settings collection you wanted.

For example, suppose you wanted to store system-wide Setler settings in Settings, but wanted each User to have Setler settings exposed as #preferences. Currently you'd need to have two tables in the DB, and two ActiveRecord models to store and retrieve them. This is a bummer if you're upgrading from an older version as you have to manually migrate any old scoped Setler settings from the settings table to the preferences table.

Thoughts?

srbiv commented 12 years ago

I agree. This would be a really nice thing, but upgrading would not be so great. If @ckdake thinks the is a good idea, I'd like to work on it.

ckdake commented 12 years ago

could be nice! I'm not strongly opinionated on this either way.