Closed mongeta closed 9 years ago
The in?
method is provided by ActiveSupport, which is a dependency of ActiveRecord and this library. Can you check if it is defined in active_support/core_ext/object/inclusion.rb
in the version you are using?
A workaround would be to change this to:
raise ParseError, 'Quarter number must be between 1 and 4' unless (1..4).include?(value)
which is equivalent and supported by native Ruby, however, the bigger problem here is "why isn't ActiveSupport being included properly?"
It's likely that the correct part of AS isn't being loaded here. I think we should probably just explicitly specify that this part of AS is required.
@mongeta can you please provide us with a script that reproduces this problem?
Simple script that reproduces the problem
require 'rubygems'
require 'active_record'
require 'by_star'
Time.zone = 'Madrid'
# your connection settings to database here
class Tax < ActiveRecord::Base
has_many :tax_line
end
a=Tax.by_quarter(1,field: :factura_data)
@johnnyshields Can you check if it is defined in active_support/core_ext/object/inclusion.rb in the version you are using?
I can't locate it know, I'll try again when I have my machine locally (I'm doing remotely now) ...
Also adding require 'active_support' didn't solve the problem
thanks to all,
This works for me:
require 'active_record'
1.in?([1,2]) #=> true
0.in?([1,2]) #=> false
I am closing this issue since it's a problem with ByStar itself, something is strange about your Ruby and/or Rails setup.
I'm using by_star in a ruby script using also Activerecord.
When I use Model.by_quarter(1), I'm getting
The culprit is line 68 at normalization.rb, method method quarter_fixnum wich checks if the month passed is 1..4
I'm using extensively by_quarter(1) on some Rails projects that work perfectly
thanks,