I am trying to embed gim-rails-settings (https://github.com/100hz/rails-settings) in a Rails 3 project using Ruby 1.8.7
Setting and retrieving settings works fine, but I get an error message if I try to get all the settings for a specific user.
So, in the "rails" console, the following actions are performed:
user = User.find(123)
user.settings.color = :red
user.settings.color
But if I try to get all the settings:
user.settings.all
I get:
NoMethodError: undefined `merge 'method for []: Array
from /โบ....BIZ/. rvm / gems / ruby-1.8.7-p334 / bundler / gems / rails-settings-883114dfd933 / lib / rails-settings / settings.rb: 55: in `all '
from (irb): 5
line 55 in settings.rb:
def self.all(starting_with=nil)
options = starting_with ? { :conditions => "var LIKE '#{starting_with}%'"} : {}
vars = thing_scoped.find(:all, {:select => 'var, value'}.merge(options))
result = {}
vars.each do |record|
result[record.var] = record.value
end
@@defaults.select{ |k| k =~ /^#{starting_with}/ }.merge(result).with_indifferent_access
end
What is the problem? Or is it ruby โโ1.8.7 versus 1.9.2?
source
share