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

  • Home
  • SEARCH
  • 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 4112954
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:15:41+00:00 2026-05-20T22:15:41+00:00

This is probably something stupid, but I don’t know nearly enough about rails &

  • 0

This is probably something stupid, but I don’t know nearly enough about rails & ruby to see it. I have the following schema & view but I am getting the error mentioned below. Business inherits from a Devise Account so thats where the email & password come from.

Any help would be greatly appreciated, thanks!

schema:

  create_table "businesses", :force => true do |t|
    t.string   "name"
    t.string   "street"
    t.string   "city"
    t.string   "zip"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

View:

#registrationForm
  -semantic_form_for(resource, :as => resource_name, :url=> registration_path(resource_name)) do |f|
    =f.input :name
    =f.input :email
    =f.input :password
    =f.input :password_confirmation
    =f.buttons

Error:

undefined method 'name' for
<Business:0x000000052690f8 > Extracted source (around line #3):

Edit

Controller

class BusinessesController < Devise::RegistrationsController 
  respond_to :html
   def new
     super
     @business = Business.new
   end
end

Routes.rb

  devise_for :accounts 
  devise_for :businesses, :controllers => { :registrations => "businesses" }
  

Model

class Business < Account 
end

console after reloading schema

k = Business.new ( :name =>"test" )
                          ^
(irb):1: syntax error, unexpected ')', expecting $end
    from /home/chance/.rvm/gems/ruby-1.9.2-p180@global/gems/railties-3.0.5/lib/rails/commands/console.rb:44:in `start'
    from /home/chance/.rvm/gems/ruby-1.9.2-p180@global/gems/railties-3.0.5/lib/rails/commands/console.rb:8:in `start'
    from /home/chance/.rvm/gems/ruby-1.9.2-p180@global/gems/railties-3.0.5/lib/rails/commands.rb:23:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
  • 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-05-20T22:15:42+00:00Added an answer on May 20, 2026 at 10:15 pm

    You have a table named ‘accounts’ and a table named ‘businesses’.

    Account is being made by devise, and has all its attributes, and points to the ‘accounts’ table.
    Business inherits from Account, and therefore is using Rails’ STI (single table inheritance) features. It therefore points to the ‘accounts’ table as well.

    If you were to have Business < ActiveRecord::Base it would point to your ‘businesses’ table. ActiveRecord’s STI mechanism is very strange.

    I think you need to think more about how you want your data model to work. Perhaps Business should belong_to :account and have an according :account_id.

    Either that or you could add all the ‘businesses’ columns to the accounts table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is something stupid I probably should know, but Googling fails me: When compiling
I'm probably doing something realy stupid but I cant get this to work: var
This is probably something really simple but I cant see what! Any images I
I know this is probably something simple but I can't seem to find anything
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'dbuser1'@'localhost This is probably something stupid, but
This is probably something stupid, but I really can't figure it out myself. I'm
This is probably something stupid as I have never deployed a Rails app before.
I know I'm doing something stupid and probably obvious, but I'm not sure what.
This is probably a stupid question but I'll chance it anyways... I've got something
This is probably something stupid I am missing but it has really got me

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.