| 39 | | if configuration[:scope].is_a?(Symbol) |
|---|
| 40 | | scope_condition_method = %( |
|---|
| 41 | | def scope_condition |
|---|
| 42 | | if #{configuration[:scope].to_s}.nil? |
|---|
| 43 | | "#{configuration[:scope].to_s} IS NULL" |
|---|
| 44 | | else |
|---|
| 45 | | "#{configuration[:scope].to_s} = \#{#{configuration[:scope].to_s}}" |
|---|
| 46 | | end |
|---|
| 47 | | end |
|---|
| 48 | | ) |
|---|
| 49 | | else |
|---|
| 50 | | scope_condition_method = "def scope_condition() \"#{configuration[:scope]}\" end" |
|---|
| | 39 | define_method :scope_condition do |
|---|
| | 40 | condition = configuration[:scope] |
|---|
| | 41 | return eval("\"#{condition}\"") unless condition.is_a?(Symbol) |
|---|
| | 42 | value = send(condition) |
|---|
| | 43 | value.nil? ? "#{condition} IS NULL" : "#{condition} = #{quote(value)}" |
|---|