Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7845879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:23:39+00:00 2026-06-02T17:23:39+00:00

I recently added namespaces to my rails app. I had a form that will

  • 0

I recently added namespaces to my rails app. I had a form that will email owners, but it seems to have broken in the process (error at bottom). The form does not have a model, it just kicks off an email.

Here is my routes file

scope ":locale", locale: /#{I18n.available_locales.join("|")}/ do
  namespace :admin do
    resources :email_owners do
      collection do
       get :email
       get :islas
       post :email
       post :islas
       end
      end
    end
  match "*path", to: "sites#not_found" # handles /en/fake/path/whatever
  end
root to: redirect("/#{I18n.default_locale}") # handles /
match '*path', to: redirect("/#{I18n.default_locale}/%{path}")
end

Output of rake routes CONTROLLER=admin/email_owners

email_admin_email_owners GET    /:locale/admin/email_owners/email(.:format)    {:locale=>/en|es/, :action=>"email", :controller=>"admin/email_owners"}
islas_admin_email_owners GET    /:locale/admin/email_owners/islas(.:format)    {:locale=>/en|es/, :action=>"islas", :controller=>"admin/email_owners"}
                     POST   /:locale/admin/email_owners/email(.:format)    {:locale=>/en|es/, :action=>"email", :controller=>"admin/email_owners"}
                     POST   /:locale/admin/email_owners/islas(.:format)    {:locale=>/en|es/, :action=>"islas", :controller=>"admin/email_owners"}
  admin_email_owners GET    /:locale/admin/email_owners(.:format)          {:locale=>/en|es/, :action=>"index", :controller=>"admin/email_owners"}
                     POST   /:locale/admin/email_owners(.:format)          {:locale=>/en|es/, :action=>"create", :controller=>"admin/email_owners"}
new_admin_email_owner GET    /:locale/admin/email_owners/new(.:format)      {:locale=>/en|es/, :action=>"new", :controller=>"admin/email_owners"}
edit_admin_email_owner GET    /:locale/admin/email_owners/:id/edit(.:format) {:locale=>/en|es/, :action=>"edit", :controller=>"admin/email_owners"}
   admin_email_owner GET    /:locale/admin/email_owners/:id(.:format)      {:locale=>/en|es/, :action=>"show", :controller=>"admin/email_owners"}
                     PUT    /:locale/admin/email_owners/:id(.:format)      {:locale=>/en|es/, :action=>"update", :controller=>"admin/email_owners"}
                     DELETE /:locale/admin/email_owners/:id(.:format)      {:locale=>/en|es/, :action=>"destroy", :controller=>"admin/email_owners"}

app/controllers/admin/email_owners.rb

class Admin::EmailOwnersController < Admin::BaseController
  def email
  owner_type = params[:owner_type]
  subject = params[:subject]
  message = params[:message]

    owners = User.owners
    owners.each do |owner|
      OwnerMailer.all_owners(owner, subject, message).deliver
    end 
      flash[:notice] = "Email has been sent to all Owners"
      redirect_to admin_sites_path
  end 
end

and here is my form, where the problem is.

<%= form_tag [:admin, email_admin_email_owners_path] do %>
To:
  <%= radio_button_tag "owner_type", "All" %> All Owners |
  <%= radio_button_tag "owner_type", "FullTime" %> FullTime |
  <%= radio_button_tag "owner_type", "PartTime" %> PartTime<br />
  <%= text_field_tag "subject", "Subject" %><br />
  <%= text_area_tag "message", "Message" %><br />
  <%= submit_tag "Send Email" %>
<% end %>

Whenever I go to the route/path
(http://localhost:3000/en/admin/email_owners/email)

I get the error

undefined method `admin_/en/admin/email_owners/email_path' for #<#<Class:0x789db30>:0x789ab78>

But i’m not sure why. Any ideas? Am I calling the wrong path? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T17:23:40+00:00Added an answer on June 2, 2026 at 5:23 pm

    form_tag takes an url as the first argument, so you should only specify the route you want it to go to:

    <%= form_tag email_admin_email_owners_path do %>
    

    Rails uses square-brackets as shortcuts to generate nested paths from strings, symbols or objects, so [:admin, :email] would generate the admin_email_path

    When you used square-brackets like [:admin, email_admin_email_owners_path] to generate this url two things happened:

    1. email_admin_email_owners_path returns ‘/en/admin/email_owners/email’
    2. evaluated within the square-brackets with :admin then gives you admin_/en/admin/email_owners/email_path which is an undifined method
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently added the JQuery autocomplete plug in and have a textbox that autocompletes
I recently added devise confirmable module to my rails app. My application runs well
I recently added some namespaces to my web.config file so that all of my
I recently added CKEditor to my app and I would like to include my
I recently added some url re-writing to my web application and had to added
We recently added a new TeamCity build agent. Because it doesn't have ASP.NET MVC
I recently added a new column to a MySQL database (featured), then added that
I recently added a :title column using Rails migration: class AddTitleToMicroposts < ActiveRecord::Migration def
I recently added new property in one class, its list property and I have
I have recently added a new column (age) to a database table (user). I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.