Forum: Ruby on Rails [activesupport::configuable] hash access

Posted by Samuel Laulhau (Guest)
on 2013-02-01 22:01
(Received via mailing list)
Hello,
I was writting my Kaminari initializer file, I encountered some problem 
to
import my configuration from a yml file to the Kaminari::configuration
that's use ActiveSupport::Configurable actually.

ActiveSupport::Configurable provides some method to access the 
configurable
keys, here is the best way I found to implement my initilizer:

Kaminari.configure do |config|
  Settings.paginate.each do |key,value|
    config.send(key.to_s+"=", value)
  end
end

That works but I would have preferred writing something like :

Kaminari.configure do |config|
  Settings.paginate.each do |key,value|
    config[key] = value
  end
end

So I have two question, Did I do that in the right way ? Why don't
implement hasn access to config ?
I wanted to write that but I not sure that's a good idea.

Thanks for reading
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.