You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry for the newbie issue, but I have problems validating an object I create using activeform-rails.
I created a new class, and included ActiveForm::Form and ActiveForm::ValidateUniqueness. When I attempt to validate a valid object (valid?), it works fine. When I attempt to validate an invalid object, I get "NameError: uninitialized constant ActiveForm::Form::ClassMethods::UnpersistentModel".
If I put in my class "include ActiveForm::UnpersistentModel" I get "NameError: uninitialized constant ActiveForm::UnpersistentModel".
If I put in my .rb file (or on my irb console) the actual code from the unpersistent_model.rb file, everything works fine.
I am sure I am doing something simple incorrectly, perhaps mixing ActiveForm::UnpersistentModel into my class incorrectly.
Your help appreciated.
The text was updated successfully, but these errors were encountered:
class Query
include ActiveForm::Form
include ActiveForm::ValidateUniqueness
include ActiveForm::Form::UnpersistentModel
end
This results in:
TypeError: wrong argument type Class (expected Module)
from (irb):7:in include' from (irb):7:inclass:Query'
from (irb):4
from /Users/acaeti/.rvm/rubies/ruby-2.1.2/bin/irb:11:in `
Yes, UnpersistentModel is a class. You must to do something like this :
require 'rails'
require 'active_record'
require 'activeform-rails'
class Query < ActiveForm::Form::UnpersistentModel
include ActiveForm::Form
include ActiveForm::ValidateUniqueness
end
Yesterday, I found this project. I think I will stop my project because the Rails one do the same thing and is maintened by the Rails team.
Hello,
Sorry for the newbie issue, but I have problems validating an object I create using activeform-rails.
I created a new class, and included ActiveForm::Form and ActiveForm::ValidateUniqueness. When I attempt to validate a valid object (valid?), it works fine. When I attempt to validate an invalid object, I get "NameError: uninitialized constant ActiveForm::Form::ClassMethods::UnpersistentModel".
If I put in my class "include ActiveForm::UnpersistentModel" I get "NameError: uninitialized constant ActiveForm::UnpersistentModel".
If I put in my .rb file (or on my irb console) the actual code from the unpersistent_model.rb file, everything works fine.
I am sure I am doing something simple incorrectly, perhaps mixing ActiveForm::UnpersistentModel into my class incorrectly.
Your help appreciated.
The text was updated successfully, but these errors were encountered: