padrino/padrino-framework · error
gem 'padrino-helpers' is required to render partials
Error message
gem 'padrino-helpers' is required to render partials
What it means
padrino-mailer's Ext module redefines partial by aliasing the pre-existing implementation as original_partial; that implementation only exists when padrino-helpers was loaded first. The guard respond_to?(:original_partial) fails when padrino-helpers is absent, so calling partial inside a mail template raises this error pointing at the missing gem.
Source
Thrown at padrino-mailer/lib/padrino-mailer/ext.rb:284
if mailer_name && !engine.to_s.index('/')
settings.views += "/#{mailer_name}" unless settings.views.include?("/#{mailer_name}")
engine = engine.to_s.sub(%r{^#{mailer_name}/}, '')
end
provides.each do |format|
part do |p|
p.content_type(format)
p.send(:render, engine, data, options, locals, &block)
add_multipart_alternate_header if html_part || provides.include?(:html)
end
end
self.body = super(engine, data, options, locals, &block) if provides.empty?
end
alias original_partial partial if instance_methods.include?(:partial)
def partial(template, options = {}, &block)
raise "gem 'padrino-helpers' is required to render partials" unless respond_to?(:original_partial)
self.body = original_partial(template, options, &block)
end
##
# Register all special template configurations Padrino has to our fake settings object.
#
def initialize_template_settings!
Padrino::Rendering.engine_configurations.each do |name, value|
settings.class.instance_eval { define_method(name) { value } }
end
end
end
end
View on GitHub (pinned to 167044f3d5)
Solutions
- Add gem 'padrino-helpers' to the Gemfile (same version constraint as padrino-mailer) and run bundle install
- If the gem is present but the error persists, require 'padrino-helpers' explicitly in boot.rb so it loads before mailer templates render
- If you intentionally ship without padrino-helpers, replace partial calls in mail templates with inline markup or full-path render calls
Example fix
# before — Gemfile gem 'padrino-mailer' # after — Gemfile gem 'padrino-mailer' gem 'padrino-helpers'
Defensive patterns
Strategy: validation
Validate before calling
# fail at boot instead of at the first mail render unless defined?(Padrino::Helpers) || Gem.loaded_specs['padrino-helpers'] abort 'add gem "padrino-helpers" to render partials inside mailers' end
Prevention
- Install padrino-helpers whenever mailer templates use partial
- Add a CI smoke test that renders every mailer template
- After Padrino upgrades, check which helpers moved into separate gems
When it happens
Trigger: Calling partial 'user_row' inside a mailer view when the Gemfile contains padrino-mailer but not padrino-helpers; using padrino-mailer standalone with a Sinatra app without the helpers gem; upgrading an app whose partials worked before helpers were extracted.
Common situations: Upgrading Padrino 0.13 to 0.14 or later, where rendering helpers moved into the separate padrino-helpers gem; minimal custom stacks that include only the mailer; Sinatra apps adopting padrino-mailer just for its DSL.
Related errors
- Engine #{engine.inspect} is not registered with Tilt
- The email '#{name}' is already defined
- mailer '#{mailer_name}' is not registered
- mailer '#{mailer_name}' has no message '#{message_name}'
- To use mailers on Windows you must set a :delivery_method, s
AI-assisted analysis of padrino/padrino-framework@167044f3d5 (2026-08-23).
Data as JSON: /api/errors/09d9cc30f1c85a17.
Report an issue: GitHub.