Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker - P1
    • Resolution: Works as Designed
    • Affects Version/s: None
    • Fix Version/s: 12_01_17
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu
    • # Replies:
      8
    • Last comment by Customer:
      true

      Description

      We are getting the "no block given (yield)" error. We are getting this when trying to retrieve a field called Building in our contact model. We are able to access all the fields, but not this field. we are getting this error. We are using Mongoid to read data from MongoDB. Please let me know if this is a bug in MongoDB or mongoid?

        Activity

        Hide
        kbanker Kyle Banker added a comment -

        Very hard to tell from what you've described. Can you provide a stack trace?

        Show
        kbanker Kyle Banker added a comment - Very hard to tell from what you've described. Can you provide a stack trace?
        Hide
        surya.rao@lexisnexis.com Surya Rao added a comment -

        hi Kyle, We dont know if this is a Mongoid or MongoDB bug. We use Mongoid to talk to Mongodb through the Rails app. we have a bunch of models in our Rails application, which are similar to our relational tables. We converted few of the models to collections in Mongo. Now we access the collections from the rails application. So we are getting the error while accessing the field in the collection. I dont know how to get the stack trace? Can i send you the MongoDB logs?

        Show
        surya.rao@lexisnexis.com Surya Rao added a comment - hi Kyle, We dont know if this is a Mongoid or MongoDB bug. We use Mongoid to talk to Mongodb through the Rails app. we have a bunch of models in our Rails application, which are similar to our relational tables. We converted few of the models to collections in Mongo. Now we access the collections from the rails application. So we are getting the error while accessing the field in the collection. I dont know how to get the stack trace? Can i send you the MongoDB logs?
        Hide
        kbanker Kyle Banker added a comment -

        Hi Surya,

        The MongoDB server logs won't help much. Can you find the place in your Rails logs where the exception occurs? There's usually an associated stack trace.

        KYle

        Show
        kbanker Kyle Banker added a comment - Hi Surya, The MongoDB server logs won't help much. Can you find the place in your Rails logs where the exception occurs? There's usually an associated stack trace. KYle
        Hide
        surya.rao@lexisnexis.com Surya Rao added a comment -

        hi Kyle, we ran the process in the rails app, while looking at the log real time and took a snapshot of the log, when its giving the error. hope this helps.

        Started GET "/Divorce/lawyer/firm/Dayton/OH/45402/Cooper-Gentile-and-Washington-Co-LPA/2042730/780/" for 127.0.0.1 at 2011-09-28 10:16:40 -0400
        Processing by OfficesController#show as HTML
        Parameters:

        {"aop"=>"Divorce", "city"=>"Dayton", "state"=>"OH", "zip"=>"45402", "firm_name"=>"Cooper-Gentile-and-Washington-Co-LPA", "flid"=>"2042730", "aop_id"=>"780"}

        MONGODB apex_development['system.namespaces'].find({})
        MONGODB apex_development['locations'].find({:city=>"Jersey", :state=>nil}).sort([[:_id, :asc]])
        MONGODB apex_development['system.namespaces'].find({})
        MONGODB apex_development['offices'].find({:flid=>2042730}).sort([[:_id, :asc]])
        MONGODB apex_development['locations'].find({:upper=>"DAYTON", :state=>"OH"}).sort([[:_id, :asc]])
        Rendered offices/_analytics.erb (0.4ms)
        Rendered offices/_aop_autocomplete.html.erb (0.7ms)
        MONGODB apex_development['system.namespaces'].find({})
        MONGODB apex_development['organizations'].find({:_id=>BSON::ObjectId('313631373430390000000000')}).sort([[:_id, :asc]])
        MONGODB apex_development['system.namespaces'].find({})
        MONGODB apex_development['$cmd'].find({"count"=>"people", "query"=>

        {"office_id"=>BSON::ObjectId('323034323733300000000000')}

        , "fields"=>nil})
        MONGODB apex_development['$cmd'].find({"count"=>"people", "query"=>

        {"office_id"=>BSON::ObjectId('323034323733300000000000')}

        , "fields"=>nil})
        MONGODB apex_development['people'].find(

        {"office_id"=>BSON::ObjectId('323034323733300000000000')}

        )
        Rendered offices/_people_search_container.html.erb (90.4ms)
        Rendered layouts/sections/_modal_crr_content.html.erb (0.3ms)
        Rendered layouts/sections/_modal_prr_content.html.erb (0.4ms)
        Rendered layouts/sections/_modal_about_client_ratings.html.erb (2.7ms)
        Rendered layouts/sections/_modal_crr_content.html.erb (0.3ms)
        Rendered layouts/sections/_modal_prr_content.html.erb (0.3ms)
        Rendered layouts/sections/_modal_about_peer_ratings.html.erb (2.6ms)
        Rendered layouts/sections/_office_peer_ratings.html.erb (3.5ms)
        Rendered offices/show.html.erb within layouts/application (460.1ms)
        Completed 500 Internal Server Error in 1357ms

        ActionView::Template::Error (no block given (yield)):
        422:
        423:
        424:
        425: <% if office_contact_info(@office).present? && office_contact_info(@office).count > 0 %>
        426: <!-- Contact Info -->
        427: <div id="contactInfo" class="widget">
        428: <div class="widgetHeader">
        app/helpers/offices_helper.rb:177:in `office_firm_address'
        app/helpers/offices_helper.rb:1056:in `office_sub_contact_info'
        app/helpers/offices_helper.rb:792:in `office_contact_info'
        app/views/offices/show.html.erb:425:in `app_views_offices_show_html_erb__2726682960343601953_2258707560_687043179711726173'

        Rendered /Users/hawkjx/.rvm/gems/ruby-1.9.2-p290@apex/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.4ms)
        Rendered /Users/hawkjx/.rvm/gems/ruby-1.9.2-p290@apex/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (3.5ms)
        Rendered /Users/hawkjx/.rvm/gems/ruby-1.9.2-p290@apex/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (8.2ms)

        Show
        surya.rao@lexisnexis.com Surya Rao added a comment - hi Kyle, we ran the process in the rails app, while looking at the log real time and took a snapshot of the log, when its giving the error. hope this helps. Started GET "/Divorce/lawyer/firm/Dayton/OH/45402/Cooper-Gentile-and-Washington-Co-LPA/2042730/780/" for 127.0.0.1 at 2011-09-28 10:16:40 -0400 Processing by OfficesController#show as HTML Parameters: {"aop"=>"Divorce", "city"=>"Dayton", "state"=>"OH", "zip"=>"45402", "firm_name"=>"Cooper-Gentile-and-Washington-Co-LPA", "flid"=>"2042730", "aop_id"=>"780"} MONGODB apex_development ['system.namespaces'] .find({}) MONGODB apex_development ['locations'] .find({:city=>"Jersey", :state=>nil}).sort([ [:_id, :asc] ]) MONGODB apex_development ['system.namespaces'] .find({}) MONGODB apex_development ['offices'] .find({:flid=>2042730}).sort([ [:_id, :asc] ]) MONGODB apex_development ['locations'] .find({:upper=>"DAYTON", :state=>"OH"}).sort([ [:_id, :asc] ]) Rendered offices/_analytics.erb (0.4ms) Rendered offices/_aop_autocomplete.html.erb (0.7ms) MONGODB apex_development ['system.namespaces'] .find({}) MONGODB apex_development ['organizations'] .find({:_id=>BSON::ObjectId('313631373430390000000000')}).sort([ [:_id, :asc] ]) MONGODB apex_development ['system.namespaces'] .find({}) MONGODB apex_development ['$cmd'] .find({"count"=>"people", "query"=> {"office_id"=>BSON::ObjectId('323034323733300000000000')} , "fields"=>nil}) MONGODB apex_development ['$cmd'] .find({"count"=>"people", "query"=> {"office_id"=>BSON::ObjectId('323034323733300000000000')} , "fields"=>nil}) MONGODB apex_development ['people'] .find( {"office_id"=>BSON::ObjectId('323034323733300000000000')} ) Rendered offices/_people_search_container.html.erb (90.4ms) Rendered layouts/sections/_modal_crr_content.html.erb (0.3ms) Rendered layouts/sections/_modal_prr_content.html.erb (0.4ms) Rendered layouts/sections/_modal_about_client_ratings.html.erb (2.7ms) Rendered layouts/sections/_modal_crr_content.html.erb (0.3ms) Rendered layouts/sections/_modal_prr_content.html.erb (0.3ms) Rendered layouts/sections/_modal_about_peer_ratings.html.erb (2.6ms) Rendered layouts/sections/_office_peer_ratings.html.erb (3.5ms) Rendered offices/show.html.erb within layouts/application (460.1ms) Completed 500 Internal Server Error in 1357ms ActionView::Template::Error (no block given (yield)): 422: 423: 424: 425: <% if office_contact_info(@office).present? && office_contact_info(@office).count > 0 %> 426: <!-- Contact Info --> 427: <div id="contactInfo" class="widget"> 428: <div class="widgetHeader"> app/helpers/offices_helper.rb:177:in `office_firm_address' app/helpers/offices_helper.rb:1056:in `office_sub_contact_info' app/helpers/offices_helper.rb:792:in `office_contact_info' app/views/offices/show.html.erb:425:in ` app_views_offices_show_html_erb __2726682960343601953_2258707560_687043179711726173' Rendered /Users/hawkjx/.rvm/gems/ruby-1.9.2-p290@apex/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.4ms) Rendered /Users/hawkjx/.rvm/gems/ruby-1.9.2-p290@apex/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (3.5ms) Rendered /Users/hawkjx/.rvm/gems/ruby-1.9.2-p290@apex/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (8.2ms)
        Hide
        kbanker Kyle Banker added a comment -

        Hi Surya,

        This is unlikely to be a Ruby driver issue. It might be a Mongoid issue, but I doubt that. A method is expecting a block but isn't being invoked with one. I would look at app/helpers/offices_helper.rb on line 177. That's the code generating the exception.

        • Kyle
        Show
        kbanker Kyle Banker added a comment - Hi Surya, This is unlikely to be a Ruby driver issue. It might be a Mongoid issue, but I doubt that. A method is expecting a block but isn't being invoked with one. I would look at app/helpers/offices_helper.rb on line 177. That's the code generating the exception. Kyle
        Hide
        surya.rao@lexisnexis.com Surya Rao added a comment -

        hi Kyle, i checked with the team and the below line in the ruby code, throws this error, and the fix to resolve the problem. The "read_attribute" fixed the problem. So do you think its a Mongoid bug?

        Old Syntax that breaks:
        line1 += office.contacts.listing.building

        New Syntax that works:
        line1 += office.contacts.listing.read_attribute(:building)

        Show
        surya.rao@lexisnexis.com Surya Rao added a comment - hi Kyle, i checked with the team and the below line in the ruby code, throws this error, and the fix to resolve the problem. The "read_attribute" fixed the problem. So do you think its a Mongoid bug? Old Syntax that breaks: line1 += office.contacts.listing.building New Syntax that works: line1 += office.contacts.listing.read_attribute(:building)
        Hide
        kbanker Kyle Banker added a comment -

        Hi Surya,

        It's hard to say without more information, and frankly, I'm not a Mongoid expert. Are you sure you've defined the field in the model? Could be a bug. Could be a change in API. Probably best to post a question to the Mongoid user list, as we don't support that project.

        I can tell you that this is not related to the Ruby driver.

        Kyle

        Show
        kbanker Kyle Banker added a comment - Hi Surya, It's hard to say without more information, and frankly, I'm not a Mongoid expert. Are you sure you've defined the field in the model? Could be a bug. Could be a change in API. Probably best to post a question to the Mongoid user list, as we don't support that project. I can tell you that this is not related to the Ruby driver. Kyle
        Hide
        kbanker Kyle Banker added a comment -

        Not a Ruby driver issue.

        Show
        kbanker Kyle Banker added a comment - Not a Ruby driver issue.

          People

          • Assignee:
            kbanker Kyle Banker
            Reporter:
            surya.rao@lexisnexis.com Surya Rao
            Participants:
            Last commenter:
            Rathi Gnanasekaran
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since reply:
              5 years, 26 weeks, 2 days ago
              Date of 1st Reply: