Skip to content

Commit

Permalink
update version
Browse files Browse the repository at this point in the history
  • Loading branch information
emfy0 committed Sep 17, 2024
1 parent 0ada4a5 commit 9fb9952
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ user.fullname # => value computed by database
User.with_total_orders.where(ArVirtualField[:total_orders] => 5)
```

> [!WARNING]
> `ArVirtualField[]` doesn't sanitize its value itself, this example relies on `#where` sanitation, use with caution
This will include the total_orders virtual field in the SQL query and allow filtering by it.

## Contributing
Expand Down
8 changes: 2 additions & 6 deletions lib/ar_virtual_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ def self.select_append(relation, *values)
end

def self.table_name(name)
sanitize_table_name("#{name}_outer")
"#{name}_outer"
end

def self.table_with_column(name)
sanitize_table_name("#{name}_outer.#{name}")
end

def self.sanitize_table_name(table)
ActiveRecord::Base.connection.quote_table_name(table)
"#{name}_outer.#{name}"
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/ar_virtual_field/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module ArVirtualField
VERSION = "0.6.0"
VERSION = "0.7.0"
end

0 comments on commit 9fb9952

Please sign in to comment.