slim_scrooge 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -2,4 +2,4 @@
2
2
  :major: 1
3
3
  :build:
4
4
  :minor: 0
5
- :patch: 9
5
+ :patch: 10
data/ext/callsite_hash.c CHANGED
@@ -6,7 +6,6 @@
6
6
 
7
7
  static int strhash(register const char *string) {
8
8
  register int c;
9
-
10
9
  register int val = 0;
11
10
 
12
11
  while ((c = *string++) != '\0') {
@@ -16,47 +15,26 @@ static int strhash(register const char *string) {
16
15
  return val + (val>>5);
17
16
  }
18
17
 
19
- static VALUE rb_f_callsite( VALUE obj ) {
18
+ static VALUE rb_f_callsite(VALUE obj) {
20
19
  struct FRAME *frame = ruby_frame;
21
20
  NODE *n;
22
- int lev = -1;
23
21
  int csite = 0;
24
22
 
25
- if (frame->last_func == ID_ALLOCATOR) {
26
- frame = frame->prev;
27
- }
28
- if (lev < 0) {
29
- ruby_set_current_source();
30
- if (frame->last_func) {
31
- csite += strhash(ruby_sourcefile) + ruby_sourceline + frame->last_func;
32
- }
33
- else if (ruby_sourceline == 0) {
34
- csite += strhash(ruby_sourcefile);
35
- }
36
- else {
37
- csite += strhash(ruby_sourcefile) + ruby_sourceline;
38
- }
39
- if (lev < -1) return INT2FIX(csite);
40
- }
41
- else {
42
- while (lev-- > 0) {
43
- frame = frame->prev;
44
- if (!frame) {
45
- csite = 0;
46
- break;
47
- }
48
- }
49
- }
23
+ if (frame->last_func == ID_ALLOCATOR) frame = frame->prev;
24
+
25
+ ruby_set_current_source();
26
+ if (ruby_sourcefile) csite += strhash(ruby_sourcefile);
27
+ csite += frame->last_func + ruby_sourceline;
28
+
50
29
  for (; frame && (n = frame->node); frame = frame->prev) {
51
30
  if (frame->prev && frame->prev->last_func) {
52
31
  if (frame->prev->node == n) {
53
32
  if (frame->prev->last_func == frame->last_func) continue;
54
33
  }
55
- csite += strhash(n->nd_file) + nd_line(n) + frame->prev->last_func;
56
- }
57
- else {
58
- csite += strhash(n->nd_file) + nd_line(n);
34
+ csite += frame->prev->last_func;
59
35
  }
36
+ if (n->nd_file) csite += strhash(n->nd_file);
37
+ csite += nd_line(n);
60
38
  }
61
39
 
62
40
  return INT2FIX(csite);
@@ -54,7 +54,7 @@ module SlimScrooge
54
54
  def essential_columns(model_class)
55
55
  model_class.reflect_on_all_associations.inject([@primary_key]) do |arr, assoc|
56
56
  if assoc.options[:dependent] && assoc.macro == :belongs_to
57
- arr << assoc.association_foreign_key
57
+ arr << assoc.primary_key_name
58
58
  end
59
59
  arr
60
60
  end
data/test/setup.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  gem 'activerecord', '= 2.3.5'
3
+ gem 'i18n', "= 0.3.7"
3
4
  require 'active_record'
4
5
  require 'active_record/connection_adapters/mysql_adapter'
5
6
  $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 9
9
- version: 1.0.9
8
+ - 10
9
+ version: 1.0.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - Stephen Sykes