16 April 2014

The Ruby Reflector

Topic

Template

  Source Favicon
By Taryn East of Ruby-coloured glasses 11 months ago.
Email

I recently had to scratch my head over a strange exception message I'd never seen before: undefined method `render' for #<SomeTemplate:0xb17da594>

The problem was, it came with *no* application trace at all... just the usual Rails stack-trace.

I had to guess at where the problem came from by grepping for SomeTemplate in the controller-action that had exploded, and came across the following line of code: @ template = SomeTemplate.new(params[:some_template])

Now entity_61 …

rubyglasses.blogspot.com Read
  Source Favicon
By Mike Gunderloy of A Fresh Cup 11 months ago.
Email

How to make a Rubygem - Setting up the basic structure.

Patching Ruby for Faster Rails Startup, Revisited - Made easier with rvm.

Curly - Template language that separates logic and structure completely.

Capybara::Select2 - Helpers to test selects that have been spiffed up with select2.

afreshcup.com Read
  Source Favicon
By Mike Gunderloy of A Fresh Cup over 1 year ago.
Email

Week of August 27 - September 2, 2012

A bunch of tinkering with ActionView internals is summarized with a doc commit at daa0ed3a . THis includes the deprecation of ActionView:: RecordIdentifier and the deprecation of Template#mime_type , the latter in favor of type . The overall goal is to make it easier to extract ActionView from ActionPack in the future.

810a50da splits up the CHANGELOG so that it's separate files on separate branches.

entity_22 …

afreshcup.com Read
  Source Favicon
By Radar of The Life Of A Radar over 3 years ago.
Email

It turns out that @ template is no longer an accessible-from-the-controller variable. Who'd have thunk it? To work around this problem, we had to use the (undocumented! grr) :action option for render_to_string , changing the final line to this: kit = PDFKit.new(render_to_string(:action => 'print.html.haml'))

We simply wanted the html version of this template, where as this code was trying to render the print.pdf.erb template which simply didn't exist.

The next issue …

frozenplague.net Read
  Source Favicon
By Iain Hecker of Adventures with Ruby almost 4 years ago.
Email

…new ( self ) end class ViewTranslator < ActiveSupport::BasicObject def initialize ( template ) @ template = template end def method_missing ( method, options = { } ) ViewTranslator. class_eval <<- RUBY def #{method}(options = {}) @ template . t ( ".#{method}" , options ) end RUBY __send__ ( method, options ) end end end

And now you can write:

= vt.foo

How does this work?

The vt method returns ViewTranslator instance. It is cached inside an instance …

iain.nl Read
  Source Favicon
By Bryan McLellan of Chef Blog almost 2 years ago.
Email

[ CHEF-2633 ] - Template, Directory, and possibly other resources fail when attempting to set user or group on Windows.

[ CHEF-2641 ] - knife not respecting options that begin with "-no-"

[ CHEF-2646 ] - knife dies badly if the HOME environment variable is not set

[ CHEF-2681 ] - Chef::Cookbook:: SyntaxCheck assumes ruby would be in the PATH

[ CHEF-2689 ] - Can not detect oracle server …

opscode.com Read
  Source Favicon
By iain hecker of Adventures with Ruby almost 4 years ago.
Email

…) end class ViewTranslator < ActiveSupport :: BasicObject def initialize (template) @ template = template end def method_missing (method, options = {}) ViewTranslator .class_eval <<- RUBY def #{ method } (options = {}) @template.t(". #{ method } ", options) end RUBY __send__(method, options) end end end

And now you can write: = vt.foo

How does this work?

The vt method returns ViewTranslator instance. It is cached inside an instance variable. …

iain.nl Read
  Source Favicon
By Thorben Schröder of Engine Yard Developer Blog almost 2 years ago.
Email

…Shadow DOM API last June and I'm sure that as soon as the HTML Template part follows, we will see a lot of movement around WebComponents and a bunch of frameworks out there will make use of this leap in web technology.

You can find a detailed and well written rundown of everything they are here . It's the damn future, don't miss it!

Debugging

Do you know what is going wrong on your site? Oh you say you're collecting all the exceptions? You even …

engineyard.com Read
  Source Favicon
By Yehuda Katz of Engine Yard Developer Blog over 4 years ago.
Email

def collection_with_template ( template = @ template ) segments, locals, as = [ ] , @ locals , @ options [ :as ] || template. variable_name counter_name = template. counter_name locals [ counter_name ] = - 1 @ collection . each do | object | locals [ counter_name ] + = 1 locals [ as ] = object segments & lt; & lt; template. render ( @ view, locals ) end @ template = template segments end

Importantly, the loop is now tiny (even simpler than what happened in Merb

engineyard.com Read
  Source Favicon
By techarch of The "Tech. Arch." over 2 years ago.
Email

…the step-by-step approach: # To Do Area 1 Create An External Template For The savings-goal-view View 2 Refactor the savings-goal-view In Our Web Page View 3 Hookup jQuery ViewLoader In Our Main application.js Application 4 Refactor The Savings Goal Mediator View Mediator

1. Create An External Template For The savings-goal-view

Our first step will be to create a new folder named view under scripts to organize our external views. Similarly to frameworks …

blog.monnet-usa.com Read