I'm pretty sure this commit provoked your problem: https://github.com/Hobo/hobo/commit/6fbb12e1db73f9a82ead69e93926613cab03282b
I'll open an issue to investigate this further and create all the necessary test cases to ensure we cover all cases. Thanks for sharing! Warm regards, Ignacio El 13-12-2014 a las 14:30, Tim Griffin escribió: > It seems this error is arising from this line within > > <page-nav param if="&this.method_defined?(:page_count) || > this.method_defined?(:total_pages)" merge-attrs="&ajax_attrs" /> > > It appears that method_defined? cannot be called on an /instance/ of > Array (although it can be called on the Array /class/): > > [tgriffin@mbp ~/Sites/crs] $ irb > 2.1.4 :004 > Array.method_defined?(:page_count) > => false > 2.1.4 :006 > a = Array.new > => [] > 2.1.4 :007 > a.method_defined?(:total_pages) > NoMethodError: undefined method `method_defined?' for []:Array > > I see this listed as a problem > <http://stackoverflow.com/questions/8013773/testing-for-method-defined-on-activerecord-classes-doesnt-work-until-an-instan> > for uninstantiated ActiveRecord classes, but why is this a problem for a > built-in class like /Array?/ > > For now, I will override the table-plus tag to drop the <page-nav> bit. > > Any other insight welcome! > Tim > > > > > On Friday, December 12, 2014 11:57:50 PM UTC-5, Tim Griffin wrote: > > Hi all; > > > In Hobo 2.1.1, I'm creating an array of OpenStructs to pass back to > a table-plus for display. This certainly works nicely in Hobo > 2.0/Ruby 1.9.3, but I'm getting an odd error with 2.1.1/Rails > 4.0.8/Ruby/2.1.4: > > undefined method `method_defined?' for #<Array:0x007fdb88622170> > app/views/taglibs/application/company.dryml:848:in `block (8 > levels) in show_page__for_company' > > > The Array I pass to a table-plus tag is created as follows: > > def get_documents > documents = Array.new > files = Dir.glob(folder + "*.{pdf,PDF}") > ... > > # Go through each of the files retrieved, and extract their > details to be usable > r = 0 > > files.each do |doc| > filing_date = "Unknown" > filing = "Unknown" > > filing_date, filing, filing_year = > Filings.decode_filename(doc, self.entity_type_code) > > if filing.present? > documents[r] = OpenStruct.new(:doc_id => doc, :filing_date > => filing_date, :filing => filing, :filing_year => filing_year) > r = r + 1 > end > end > return documents > end > > A sample Array I passed to the table-plus tag is as follows: > > [ > #<OpenStruct doc_id="711021-140619-IN.PDF", filing_date="140619", > filing="Incorporation", filing_year="NA">, > #<OpenStruct doc_id="711021-140619-ND.PDF", filing_date="140619", > filing="Notice/Change of Directors", filing_year="NA"> > ] > > And, the table-plus tag is nothing unusual: > > <% documents = this.get_documents %> > <if test="&documents.present?"> > <table-plus with="&documents" > fields="filing,filing_date,filing_year, doc_id"> > </table-plus> > </if> > > Does anyone know why this might be causing the *undefined method > `method_defined?' for Array* error? > > Some new anomaly with Rails 4 / Ruby 2? > > Many thanks, > Tim > > > > > -- > You received this message because you are subscribed to the Google > Groups "Hobo Users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/hobousers. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/hobousers. For more options, visit https://groups.google.com/d/optout.
