#49 ✓resolved
Lucas Efe

view helpers not available on production

Reported by Lucas Efe | February 8th, 2009 @ 12:16 PM

Hi, I am having a hardtime, I must say.

I have the following problem. Looks like all the view helpers are not available. its a weird behaviour.

This is the error message:

NoMethodError in Cuentas#index Showing app/views/cuentas/_cuentas.html.haml where line #7 raised: undefined method order_by_link' for #<ActionView::Base:0x26e2fec>

In development, the first request produce the error, but if I reload the page, it disappears and everything works fine. In production, of course, it doesn't get fixed, because of the way the classes are loaded.

I am using searchlogic as a frozen gem in vendor/gems, but I also tried it as a plugin.

Rails 2.2.2 with haml and resource_controller.

If I check the ActionView::Base included modules, it doesn't include all the Searchlogic's helpers, just this ones:

=> [#<Module:0x1a93f48>, ActionController::Routing::Helpers, ActionController::PolymorphicRoutes, Searchlogic::Helpers::Form::Base, Searchlogic::Helpers::Form::Shared, MultiHelper::FormBuilder::Helper, MultiHelper::Navigation::Helper, ActionView::Helpers, ActionView::Helpers::UrlHelper, ActionView::Helpers::JavaScriptHelper, ActionView::Helpers::TranslationHelper, ActionView::Helpers::TextHelper, ActionView::Helpers::TagHelper, ActionView::Helpers::ScriptaculousHelper, ActionView::Helpers::SanitizeHelper, ActionView::Helpers::RecordTagHelper, ActionView::Helpers::RecordIdentificationHelper, ActionView::Helpers::PrototypeHelper, ActionView::Helpers::NumberHelper, ActionView::Helpers::FormTagHelper, ActionView::Helpers::FormOptionsHelper, ActionView::Partials, ActiveSupport::Memoizable::Freezable, ActionView::Base::CompiledTemplates, ERB::Util, ActionView::Helpers::FormHelper, ActionView::Helpers::DebugHelper, ActionView::Helpers::DateHelper, ActionView::Helpers::CaptureHelper, ActionView::Helpers::CacheHelper, ActionView::Helpers::BenchmarkHelper, ActionView::Helpers::AtomFeedHelper, ActionView::Helpers::AssetTagHelper, ActionView::Helpers::ActiveRecordHelper, Searchlogic::CoreExt::Object, ERB::Util, ActiveSupport::Dependencies::Loadable, InstanceExecMethods, Base64::Deprecated, Base64, Kernel]

Well, any idea?

Thanks in advance.

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson February 8th, 2009 @ 02:38 PM

    • State changed from “new” to “open”

    That is really strange. I have to say, lately most of the errors and problems I have been getting have to deal with the rails caching. They have changed that so much, which is good, but its been causing a lot of problems. Did you run rake rails:update when you updated rails, if you ever did. It really sounds like a classic caching issue.

  • Lucas Efe

    Lucas Efe February 8th, 2009 @ 02:53 PM

    In a moment I was trying to make it work work with rails 2.3. I runed rake rails:update and then I removed vendor/rails and stayed with rails2.2.2, but maybe some of the app structure remain updated. How can I know that? Which files do I have to check to know that?

  • Ben Johnson

    Ben Johnson February 8th, 2009 @ 02:56 PM

    Honestly, the rails caching is such a mess and changes so much I am not current with how it works. But I believe your environment/* files contains all of the caching settings. Try running rake rails:update again, I bet 2.2.2 will kick in and change things back.

  • Lucas Efe

    Lucas Efe February 8th, 2009 @ 06:35 PM

    Well, I did that, and now I have a new problem (the old one is still present).

    NoMethodError in Ingresos#index

    Showing app/views/ingresos/_search.html.haml where line #1 raised:

    undefined method searchlogic_base64_value' for #<ActionView::Base:0x26e25b0>

    lucas@driven:~/programming/cmg$ script/about About your application's environment Ruby version 1.8.6 (i686-darwin9.6.0) RubyGems version 1.3.1 Rails version 2.2.2 Active Record version 2.2.2 Action Pack version 2.2.2 Active Resource version 2.2.2 Action Mailer version 2.2.2 Active Support version 2.2.2 Application root /Users/lucas/programming/cmg Environment development Database schema version 20090124135009

    Any clue? Now I am for sure in 2.2.2.

  • Lucas Efe

    Lucas Efe February 9th, 2009 @ 08:51 AM

    Ben, today I tried to understand what was going on. I created a new project, based on rails 2.2.2, added the searchlogic gem and resource controller. Then 'script/generate scaffold Product title:string' (just to generate something). Went to the browser, entered '/products' and the same thing happened.

    First request:

    ActionView::TemplateError (undefined method order_by_link' for #<ActionView::Base:0x2830e44>) on line [#5](/projects/16601/tickets/5 "Ticket #5") of app/views/products/index.html.erb: 2: 3: <table> 4: <tr> 5: <th><%= order_by_link :name %></th> 6: <th>Price</th> 7: </tr> 8:

    Second request: Everything's fine.

    After that I removed resource controller from the plugin directory, and the magic happened. No more problems.

    Well, there's clearly a problem with resource controller. The funny thing is that with an older version of RC there's no problem. It works ok, but with the latest its when it fails.

    I think I'll stick with the old r_c's version. I should probably report this to Jamis Buck, right?

    Thanks for everything.

  • Lucas Efe

    Lucas Efe February 9th, 2009 @ 09:01 AM

    Update! I removed only one line from on file in the ResourceController plugin and it worked ok too.

    The file is lib/resource_controller.rb and the line is the first one

    require_dependency 'application'

    The thing is I dont't know the implications. I'll figure it out soon.

    Best regards. Love Searchlogic.

  • Ben Johnson

    Ben Johnson February 9th, 2009 @ 01:23 PM

    • State changed from “open” to “resolved”

    Yes, I would definitely let him know about it. Thanks for the update.

  • schof

    schof February 23rd, 2009 @ 08:35 PM

    I experienced a similar problem with the helpers not being available. In my case I had no problem in development at all (not even the first time.) In production I was getting this problem intermittently. The intermittent nature seemed to be caused by a Passenger timeout. So we could reproduce 100% of the time when setting the timeout to 10 sec. in production.

    Like Lucas, I am using resource_controller and an unpacked (vendor) version of the gem (1.6.3.) Fortunately I can report that the problem went away entirely when I removed from vendor/gems. Same gem, just stopped unpacking.

    Another interesting finding is that I could not reproduce the problem locally by switching to production mode. I suspect that the OS may be a factor.

    Development (No problems)

    OS X Mongrel

    Production - Local (No Problems)

    OS X Mongrel

    Production (Problem on first and periodic subsequent requests)

    Cent OS Passenger

  • schof

    schof March 25th, 2009 @ 03:38 PM

    Problem appears to be solved in Rails 2.3

  • Raza Ali

    Raza Ali July 23rd, 2009 @ 04:11 AM

    Hi Ben,

    IM facing the same issue and strange enough that gem code is missing Searchlogic::Helpers::ControlTypes and hence IM unable to access remote_order_by_link helper. Any guide.
    

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Provides common named scopes and object based searching.

People watching this ticket

Pages