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


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/cYjJ3wzyRUAJ.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 1, '13 at 9:00p
activeFeb 1, '13 at 9:00p
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Samuel Laulhau: 1 post

People

Translate

site design / logo © 2022 Grokbase