Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for AA 0.6.1 #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ doc
.yardoc
.rbenv-version
.ruby-version
Gemfile.lock
272 changes: 0 additions & 272 deletions Gemfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion lib/active_admin/axlsx/resource_controller_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def index_with_xlsx(options={}, &block)
# patching per_page to use the CSV record max for pagination when the format is xlsx
def per_page_with_xlsx
if request.format == Mime::Type.lookup_by_extension(:xlsx)
return max_csv_records
return max_per_page
end
per_page_without_xlsx
end
Expand Down
4 changes: 2 additions & 2 deletions spec/axlsx/unit/resource_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
response.headers["Content-Transfer-Encoding"].should == 'binary'
end

it 'returns max_csv_records for per_page' do
controller.send(:per_page).should == controller.send(:max_csv_records)
it 'returns max_per_page for per_page' do
controller.send(:per_page).should == controller.send(:max_per_page)
end

it 'kicks back to the default per_page when we are not specifying a xlsx mime type' do
Expand Down
6 changes: 4 additions & 2 deletions spec/support/rails_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
generate :model, "post title:string body:text published_at:datetime author_id:integer category_id:integer"
inject_into_file 'app/models/post.rb', " belongs_to :author, :class_name => 'User'\n belongs_to :category\n accepts_nested_attributes_for :author\n", :after => "class Post < ActiveRecord::Base\n"
# Rails 3.2.3 model generator declare attr_accessible
inject_into_file 'app/models/post.rb', " attr_accessible :author\n", :before => "end" if Rails::VERSION::STRING >= '3.2.3'
if Gem::Version.new(::Rails::VERSION::STRING) >= Gem::Version.new('3.2.3')
inject_into_file 'app/models/post.rb', " attr_accessible :author\n", :before => "end"
end
generate :model, "user type:string first_name:string last_name:string username:string age:integer"
inject_into_file 'app/models/user.rb', " has_many :posts, :foreign_key => 'author_id'\n", :after => "class User < ActiveRecord::Base\n"
generate :model, "publisher --migration=false --parent=User"
Expand All @@ -26,7 +28,7 @@
id_model_setup = <<-EOF
self.primary_key = :id
before_create :set_id

private
def set_id
self.id = 8.times.inject("") { |s,e| s << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }
Expand Down