0

It seems I am missing the magic of ruby on rails 4. I wanted to create an object which includes ActiveModel::Model but which class name contains two words.

Therefore I created app/models/registration_form.rb with the following code:

class RegistrationForm
    include ActiveModel::Model
    attr_accessor(:email)
    validates :email, presence: true
end

When the object is created within the controller by using RegistrationForm.new the following error occurs:

Could not find table 'registration_forms'

When I just delete the postfix Form and rename the file to app/models/registration.rb everthing works fine.

When the code from above is executed within rails console everything works fine, too.

The stacktrace of the error shows that ActiveRecord is called: https://gist.github.com/anonymous/273986937cd774b5953c

AlexN
  • 1,613
  • 8
  • 21

1 Answers1

0

It looks like you are trying to initialise an ActiveRecord object in your parties controller. It may simply be a name collision. Do you have another file defining RegistrationForm as a regular ActiveRecord model?

Jesuspc
  • 1,664
  • 10
  • 25