ckdake/setler

README typo?

Closed this issue · 3 comments

Should

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

Really be:

class User < ActiveRecord::Base
  has_setler :settings
end

?

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?

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.

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