Skip to content

Commit cb8a3da

Browse files
committed
Fix typo
1 parent 82f3445 commit cb8a3da

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,15 @@ end
212212

213213
See [here](#columns-syntax) to get more details about columns definitions and how to play with associated models.
214214

215-
You can customize or sanitize the search value passed to the DB by using the `:formater` option :
215+
You can customize or sanitize the search value passed to the DB by using the `:formatter` option :
216216

217217
```ruby
218218
def view_columns
219219
@view_columns ||= {
220220
id: { source: "User.id" },
221221
first_name: { source: "User.first_name" },
222222
last_name: { source: "User.last_name" },
223-
email: { source: "User.email", formater: -> (o) { o.upcase } },
223+
email: { source: "User.email", formatter: -> (o) { o.upcase } },
224224
bio: { source: "User.bio" },
225225
}
226226
end

lib/ajax-datatables-rails/datatable/column.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ def custom_field?
5252
!source.include?('.')
5353
end
5454

55-
# Add formater option to allow modification of the value
55+
# Add formatter option to allow modification of the value
5656
# before passing it to the database
57-
def formater
58-
@view_column[:formater]
57+
def formatter
58+
@view_column[:formatter]
5959
end
6060

6161
def formated_value
62-
formater ? formater.call(search.value) : search.value
62+
formatter ? formatter.call(search.value) : search.value
6363
end
6464

6565
private

spec/ajax-datatables-rails/datatable/column_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@
128128
end
129129
end
130130

131-
describe '#formater' do
131+
describe '#formatter' do
132132
let(:datatable) { DatatableWithFormater.new(view) }
133133
let(:column) { datatable.datatable.columns.find { |c| c.data == 'last_name' } }
134134

135135
it 'should be a proc' do
136-
expect(column.formater).to be_a(Proc)
136+
expect(column.formatter).to be_a(Proc)
137137
end
138138
end
139139

spec/support/datatable_cond_string.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ def view_columns
1818

1919
class DatatableWithFormater < ComplexDatatable
2020
def view_columns
21-
super.deep_merge(last_name: { formater: -> (o) { o.upcase } })
21+
super.deep_merge(last_name: { formatter: -> (o) { o.upcase } })
2222
end
2323
end

0 commit comments

Comments
 (0)