Skip to content

Commit 9185d12

Browse files
committed
deprecate csv_column_separator in favor of using csv_options
1 parent 1a4c214 commit 9185d12

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

lib/active_admin/application.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ def self.inheritable_setting(name, default)
1212
setting name, default
1313
end
1414

15+
def self.deprecated_inheritable_setting(name, default)
16+
Namespace.deprecated_setting name, nil
17+
deprecated_setting name, default
18+
end
19+
1520
# The default namespace to put controllers and routes inside. Set this
1621
# in config/initializers/active_admin.rb using:
1722
#
@@ -66,9 +71,6 @@ def self.inheritable_setting(name, default)
6671
# The namespace root.
6772
inheritable_setting :root_to, 'dashboard#index'
6873

69-
# Default CSV separator
70-
inheritable_setting :csv_column_separator, ','
71-
7274
# Default CSV options
7375
inheritable_setting :csv_options, {}
7476

@@ -85,6 +87,9 @@ def self.inheritable_setting(name, default)
8587

8688
# == Deprecated Settings
8789

90+
# @deprecated Default CSV separator will be removed in 0.6.0. Use `csv_options = { :col_sep => ',' }` instead.
91+
deprecated_inheritable_setting :csv_column_separator, ','
92+
8893
# @deprecated The default sort order for index pages
8994
deprecated_setting :default_sort_order, 'id_desc'
9095

spec/unit/application_spec.rb

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
application.site_title = "New Title"
3131
application.site_title.should == "New Title"
3232
end
33-
33+
3434
it "should store the site's title link" do
3535
application.site_title_link.should == ""
3636
end
@@ -39,11 +39,11 @@
3939
application.site_title_link = "http://www.mygreatsite.com"
4040
application.site_title_link.should == "http://www.mygreatsite.com"
4141
end
42-
42+
4343
it "should store the site's title image" do
4444
application.site_title_image.should == ""
4545
end
46-
46+
4747
it "should set the site's title image" do
4848
application.site_title_image = "http://railscasts.com/assets/episodes/stills/284-active-admin.png?1316476106"
4949
application.site_title_image.should == "http://railscasts.com/assets/episodes/stills/284-active-admin.png?1316476106"
@@ -53,7 +53,7 @@
5353
application.view_factory.should be_an_instance_of(ActiveAdmin::ViewFactory)
5454
end
5555

56-
it "should have deprecated admin notes by default" do
56+
it "should have deprecated admin notes by default" do
5757
application.admin_notes.should be_nil
5858
end
5959

@@ -80,6 +80,19 @@
8080
end
8181
end
8282

83+
describe "inheritable settings" do
84+
it "should set csv_options" do
85+
application.csv_options.should == {}
86+
end
87+
88+
context "when deprecated" do
89+
it "should set and warn csv_column_separator" do
90+
ActiveAdmin::Deprecation.should_receive(:warn)
91+
application.csv_column_separator.should == ','
92+
end
93+
end
94+
end
95+
8396
describe "files in load path" do
8497
it "should load files in the first level directory" do
8598
application.files_in_load_path.should include(File.expand_path("app/admin/dashboard.rb", Rails.root))

0 commit comments

Comments
 (0)