Skip to content

Commit

Permalink
fixed the build for Rubinus
Browse files Browse the repository at this point in the history
  • Loading branch information
bbenezech committed Dec 16, 2011
1 parent 55ab372 commit 32e1688
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/rails_admin/config/has_fields.rb
Expand Up @@ -104,12 +104,13 @@ def fields_of_type(type, &block)

# Accessor for all fields
def all_fields
(ro_fields = _fields(true)).select(&:defined).presence || ro_fields
((ro_fields = _fields(true)).select(&:defined).presence || ro_fields).map{|f| f.section = self; f }
end

# Get all fields defined as visible, in the correct order.
def visible_fields
all_fields.map {|f| f.with(bindings) }.select(&:visible).sort{|a, b| a.order <=> b.order }
i = 0
all_fields.map {|f| f.with(bindings) }.select(&:visible).sort_by{|f| [f.order, i += 1] } # stable sort, damn
end

protected
Expand All @@ -123,7 +124,7 @@ def _fields(readonly = false)

unless self.class == RailsAdmin::Config::Sections::Base
# parent is RailsAdmin::Config::Model, recursion is on Section's classes
@_ro_fields ||= parent.send(self.class.superclass.to_s.underscore.split('/').last)._fields(true).map{|f| f.section = self; f}.freeze
@_ro_fields ||= parent.send(self.class.superclass.to_s.underscore.split('/').last)._fields(true).freeze
else # recursion tail
@_ro_fields = @_fields = RailsAdmin::Config::Fields.factory(self).map{|f| f.group :default; f }
end
Expand Down

0 comments on commit 32e1688

Please sign in to comment.