app/models/toc_item.rb
# TODO - sure, we can code this with english labels, but it should STORE ids.
sure, we can code this with english labels, but it should STORE ids.
sure we can code this with english labels but it should STORE ids .
def common_names
      InfoItem
      cached('common_names') do
        r = TocItem.find_all_by_parent_id(self.name_and_taxonomy.id, include: [ :info_items, { parent: :info_items } ]).select{ |t| t.label('en') == 'Common Names' }
        r.blank? ? nil : r[0]
      end
    end
def common_names InfoItem cached ( 'common_names' ) do r = TocItem . find_all_by_parent_id ( self . name_and_taxonomy . id , include : [ :info_items , { parent : :info_items } ] ) . select { | t | t . label ( 'en' ) == 'Common Names' } r . blank? ? nil : r [ 0 ] end end
TODO - sure, we can code this with english labels, but it should STORE ids.
TODO - sure we can code this with english labels but it should STORE ids .