0

I am using the monologue gem and trying to create an email list signup form on one of the monologue pages. Here is the code:

<%= form_for EmailList.new, url: email_lists_path, remote: true, class: 'form-horizontal' do |f| %>
    <%= f.text_field :email, id: 'userid', class: 'form-control input-medium email-field', placeholder: 'email', required: "" %>
    <%= f.submit "Sign In", class: 'btn btn-success' %>
<% end %>

and here is how the route is defined when i run rake routes:

email_lists POST       /email_lists(.:format)                    email_lists#create

So it should be working but instead I get this error:

undefined local variable or method `email_lists_path' for #<#<Class:0x007fdddf519a40>:0x007fdde482bd78>

It has something to do with how the monologue engine is mounted:

mount Monologue::Engine, at: '/blog'

Any way, how do I add routes that work within the blog?

Philip7899
  • 4,599
  • 4
  • 55
  • 114
  • Try changing `email_lists_path` to `email_lists` – dan-klasson Dec 04 '15 at 06:52
  • Thanks, tried that but has no effect. I get the same error except is says "email_lists" instead of "email_lists_path" – Philip7899 Dec 04 '15 at 14:55
  • I am fairly new to rails and I've never worked with monologue, but I find it a bit strange your `rake routes` would come out without `_path`. If I were you i'd submit an issue on their Github page. – dan-klasson Dec 04 '15 at 15:05
  • I've never seen _path in rake routes. It's not supposed to have it there. It purposefully does not include the last part because there are things other than _path such as _url that it can show. – Philip7899 Dec 04 '15 at 17:36
  • @Philip7899 where is located that ERB file and where is defined the route? It looks like they are not in the same context...maybe? Is that repo public? – jipiboily Dec 05 '15 at 00:43

0 Answers0