Re: [Hobo Users] GMAPS4RAILS: Error no block given (yield)

63 views
Skip to first unread message

Bryan Larsen

unread,
Jan 1, 2013, 11:40:32 AM1/1/13
to hobo...@googlegroups.com
yield isn't used in DRYML since DRYML doesn't use layouts. DRYML has
much better mechanisms for arranging page layouts than the standard
Rails layouts. See the DRYML guide for more details.

And it appears that you at least partly understand this, since you're
using <append-head:>. I think if you just got rid of the line with
your yield it should work.

Bryan

On Mon, Dec 31, 2012 at 5:38 PM, <herrw...@gmail.com> wrote:
> I followed the instructions, but getting this error. Been wrestling with
> this for several days. I've been able to get maps to run without using
> HOBO, but HOBO seems to have another hidden layer that causes this error.
> Any ideas? Thank you very much in advance for
> any assistance.
>
> System:
> Description: Ubuntu 10.04 LTS
> Release: 10.04
> Codename: lucid
>
> Model:
> class Offer < ActiveRecord::Base
> hobo_model # Don't put anything above this
> fields do
> title :string
> location :string
> longitude :float
> latitude :float
> timestamps
> end
> attr_accessible :location, :latitude, :longitude, :title
> acts_as_gmappable
> def gmaps4rails_address
> location
> end
> def gmaps4rails_infowindow
> "<h4>#{title}</h4>" << "<h4>#{location}</h4>"
> end
> def geocode?
> (!location.blank? && (latitude.blank? || longitude.blank?)) ||
> location_changed?
> end
>
> Controller:
> class OffersController < ApplicationController
> hobo_model_controller
> auto_actions :all
> def index
> @json = Offer.all.to_gmaps4rails
> hobo_index
> end
>
>
> View (front_site.dryml) :
> 317: <def tag="index-page" for="Offer">
> 318: <index-page2 merge> <!-- For clarity just renamed the old index-page
> to index-page2 -->
> 319: <append-head:>
> 320: <%= stylesheet_link_tag 'gmaps4rails' %>
> 321: <%= yield :head %>
> 322: </append-head:>
> 323:
> 324: <append-body:>
> 325: <%= gmaps4rails(@json) %>
> 326: <%= yield :scripts %>
> 327: </append-body:>
> 328:
> 329: </index-page2>
> 330: </def>
>
>
> Log:
> DRYML: Compiled app/views/taglibs/front_site.dryml in 2.23s
> Rendered controller: offers; dryml-tag: index-page (109.6ms)
> Completed 500 Internal Server Error in 2541ms
>
> ActionView::Template::Error (no block given (yield)):
> 0 app/views/taglibs/front_site.dryml:323:in `block (4 levels) in
> index_page__for_offer'
> app/views/taglibs/front_site.dryml:319:in `block (3 levels) in
> index_page__for_offer'
> app/views/taglibs/themes/clean/clean.dryml:2:in `block in
> page_with_aaa82d3a9ca5'
> app/views/taglibs/themes/clean/clean.dryml:1:in `page_with_aaa82d3a9ca5'
> app/views/taglibs/front_site.dryml:12:in `block in page_with_a01db0dae7fd'
> app/views/taglibs/front_site.dryml:11:in `page_with_a01db0dae7fd'
> app/views/taglibs/front_site.dryml:283:in `block in index_page2'
> app/views/taglibs/front_site.dryml:281:in `index_page2'
> app/views/taglibs/front_site.dryml:318:in `block in index_page__for_offer'
> app/views/taglibs/front_site.dryml:317:in `index_page__for_offer'
>
> Rendered
> /usr/local/rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/_trace.erb
> (57.8ms)
> Offer Load (1.4ms) SELECT "offers".* FROM "offers" ORDER BY title LIMIT 5
> OFFSET 0
> Rendered
> /usr/local/rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb
> (29.5ms)
> Rendered
> /usr/local/rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/template_error.erb
> within rescues/layout (92.9ms)
>
>
> Gemfile:
> source 'http://rubygems.org'
> gem 'rails'
> gem 'pg'
> gem 'gmaps4rails', '1.5.6'
> gem "hobo", "1.3.2"
>
>
> GemList:
> *** LOCAL GEMS ***
> abstract (1.0.0)
> actionmailer (3.2.9, 3.0.17, 3.0.12, 3.0.10)
> actionpack (3.2.9, 3.0.17, 3.0.12, 3.0.10)
> activemodel (3.2.9, 3.0.17, 3.0.12, 3.0.10)
> activerecord (3.2.9, 3.0.17, 3.0.12, 3.0.10)
> activeresource (3.2.9, 3.0.17, 3.0.12, 3.0.10)
> activesupport (3.2.9, 3.0.17, 3.0.12, 3.0.10)
> arel (3.0.2, 2.0.10)
> builder (3.0.4, 2.1.2)
> bundler (1.2.3, 1.1.2)
> coffee-rails (3.2.2)
> coffee-script (2.2.0)
> coffee-script-source (1.4.0)
> crack (0.3.1)
> daemons (1.1.9, 1.1.8)
> dryml (1.3.2, 1.3.0)
> erubis (2.7.0, 2.6.6)
> eventmachine (1.0.0, 0.12.10)
> execjs (1.4.0)
> gmaps4rails (1.5.6, 0.7.7)
> hike (1.2.1)
> hobo (1.3.2, 1.3.0)
> hobo_fields (1.3.2, 1.3.0)
> hobo_support (1.3.2, 1.3.0)
> i18n (0.6.1, 0.5.0)
> journey (1.0.4)
> jquery-rails (2.1.4)
> json (1.7.6, 1.7.5, 1.6.5)
> mail (2.4.4, 2.2.19)
> mime-types (1.19, 1.18, 1.17.2)
> multi_json (1.5.0)
> pg (0.14.1, 0.13.2)
> polyglot (0.3.3)
> postgres (0.8.1)
> rack (1.4.1, 1.2.5)
> rack-cache (1.2)
> rack-mount (0.8.3, 0.6.14)
> rack-ssl (1.3.2)
> rack-test (0.6.2, 0.5.7)
> rails (3.2.9, 3.0.10)
> railties (3.2.9, 3.0.17, 3.0.12, 3.0.10)
> rake (10.0.3, 0.9.2.2, 0.9.2)
> rdoc (3.12)
> sass (3.2.4)
> sass-rails (3.2.5)
> sprockets (2.2.2)
> sqlite3 (1.3.6, 1.3.5)
> sqlite3-ruby (1.3.3)
> thin (1.5.0, 1.3.1)
> thor (0.16.0, 0.14.6)
> tilt (1.3.3)
> treetop (1.4.12, 1.4.10)
> tzinfo (0.3.35, 0.3.32, 0.3.31)
> uglifier (1.3.0)
> will_paginate (3.0.3, 3.0.2)
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/LSKJXDlQQ1kJ.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to
> hobousers+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.

Bryan Larsen

unread,
Jan 2, 2013, 3:27:49 PM1/2/13
to hobo...@googlegroups.com
DRYML doesn't support yield, so you're going to have to find some
other way of doing it. Some possibilities:

- helpers
- asset pipeline
- render :partial

You can check to see if gmap4rails supports any of the above
mechanisms for adding its javascript instead of using yield.

If it doesn't, then you may have to manually insert the script tags manually.

Bryan

On Wed, Jan 2, 2013 at 2:31 PM, <herrw...@gmail.com> wrote:
> Thanks Bryan, but simply removing the lines with yield removes the error (as
> expected), but does not achieve the desired result of drawing the map.
> DRYML is simple enough for green field development, but I'm trying to
> integrate with the GMAPS4RAILS gem which seems to desire the yield
> statement. Any ideas on how to satisfy GMAPS4RAILS needs using DRYML?
> https://groups.google.com/d/msg/hobousers/-/D4LG41ywIfYJ.

herrw...@gmail.com

unread,
Jan 3, 2013, 11:57:06 AM1/3/13
to hobo...@googlegroups.com
The solution in case anyone runs into this problem is to simply use "content_for(:scripts)" instead of the "yield(:scripts).
Reply all
Reply to author
Forward
0 new messages