Skip to content

Commit

Permalink
updated changelog and version
Browse files Browse the repository at this point in the history
  • Loading branch information
leikind committed Aug 28, 2015
1 parent 20acd35 commit 436f32b
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 18 deletions.
32 changes: 21 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

* No more

column model: 'ModelClass' do
column model: 'ModelClass' do

Instead:

column assoc: :association_name do
column assoc: :association_name do

or

column assoc: [:association_x, association_in_association_x_model, ...] do
column assoc: [:association_x, association_in_association_x_model, ...] do

If associations have been mentioned in :assoc, it is not necessary to list them in :include!

Expand All @@ -35,24 +35,34 @@

Instead of

g.column name: 'Priority', attribute: 'name', assoc: :priority do |task|
task.priority.name if task.priority
end
g.column name: 'Priority', attribute: 'name', assoc: :priority do |task|
task.priority.name if task.priority
end

you can write

g.column name: 'Priority', attribute: 'name', assoc: :priority
g.column name: 'Priority', attribute: 'name', assoc: :priority

Instead of

g.column name: 'Customer', attribute: 'name', assoc: [:project, :customer] do |task|
task.project.customer.name if task.project && task.project.customer
end
g.column name: 'Customer', attribute: 'name', assoc: [:project, :customer] do |task|
task.project.customer.name if task.project && task.project.customer
end

you can write

g.column name: 'Customer', attribute: 'name', assoc: [:project, :customer]
g.column name: 'Customer', attribute: 'name', assoc: [:project, :customer]

* CI_LIKE feature from @nathanvda for string filters:

Setting a configuration value in Wice::Defaults::STRING_MATCHING_OPERATORS to CI_LIKE will result in
the following SQL:

UPPER(table.field) LIKE UPPER(?)"

* New USE_DEFAULT_SCOPE configuration value from @nathanvda.
By default ActiveRecord calls are always executed inside Model.unscoped{}.
Setting USE_DEFAULT_SCOPE to true will use the default scope for all queries.


# 3.5.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-->

* Yuri Leikind, yuri.leikind at gmail dot com
* Version 3.6.0dev
* Version 3.6.0.pre1
* This tutorial is accompanied by a sample application with WiceGrid examples which you can browse online:
http://wicegrid.herokuapp.com, or just view the code: https://github.com/leikind/wice_grid_testbed.

Expand Down
6 changes: 5 additions & 1 deletion lib/generators/wice_grid/templates/wice_grid_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@

# Defining one string matching operator globally for the whole application turns is not enough
# when you connect to two databases one of which is MySQL and the other is Postgresql.
# If the key for an adapter is missing it will fall back to Wice::Defaults::STRING_MATCHING_OPERATOR
# If the key for an adapter is missing it will fall back to Wice::Defaults::STRING_MATCHING_OPERATOR.
#
# 'CI_LIKE' is a special value. Setting a value in STRING_MATCHING_OPERATORS to CI_LIKE will result in the following SQL:
#
# UPPER(table.field) LIKE UPPER(?)"
Wice::Defaults::STRING_MATCHING_OPERATORS = {
'ActiveRecord::ConnectionAdapters::MysqlAdapter' => 'LIKE',
'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter' => 'ILIKE'
Expand Down
8 changes: 4 additions & 4 deletions lib/wice/columns/column_string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ def generate_conditions(table_alias, opts) #:nodoc:
string_matching_operator = ::Wice.get_string_matching_operators(@column_wrapper.model)

comparator = if string_matching_operator == 'CI_LIKE'
" #{negation} UPPER(#{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name}) LIKE UPPER(?)"
else
" #{negation} #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} #{string_matching_operator} ?"
end
" #{negation} UPPER(#{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name}) LIKE UPPER(?)"
else
" #{negation} #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} #{string_matching_operator} ?"
end

[ comparator, '%' + string_fragment + '%' ]

Expand Down
2 changes: 1 addition & 1 deletion wice_grid.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# encoding: utf-8
Gem::Specification.new do |s|
s.name = 'wice_grid'
s.version = '3.6.0dev'
s.version = '3.6.0.pre1'
s.authors = ['Yuri Leikind']
s.email = ['yuri.leikind@gmail.com']
s.homepage = 'https://github.com/leikind/wice_grid'
Expand Down

0 comments on commit 436f32b

Please sign in to comment.