glebm / rails_email_preview

Preview and edit app mailer templates in Rails.

Home Page:http://glebm.github.io/rails_email_preview

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

undefined local variable or method `rails_email_preview'

accessd opened this issue · comments

I have error undefined local variable or method 'rails_email_preview' for #<#<Class:0x007f82fd260160>:0x007f8304bb8968> on views/rails_email_preview/emails/index.html.slim:10 (rails_email_preview.rep_email_url)

environment:
rails (4.1.1)
rails_email_preview (0.2.20)

@accessd I've the same problem. You managed to solve the problem.

@accessd I'll see your fix, thanks.

The fix from @accessd also works for me using Rails 4.2.1 and Rails Email Preview 0.2.20

@scottharvey Why are you using 0.2.20 and not 0.2.29? I can merge a PR with the fix, though I have never been able to reproduce this error myself.

@glebm I looked into this further and in my case it was because I had moved the route inside the :admin namespace like this:

namespace :admin do
  mount RailsEmailPreview::Engine, at: 'emails'
end

Instead of keeping it at the top of the routes file and names spacing it like this

mount RailsEmailPreview::Engine, at: 'admin/emails'

This seems to be working now, thanks for the reply 😄