Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator issue with Formtastic dependency #104

Closed
natebird opened this issue Feb 2, 2011 · 11 comments
Closed

Generator issue with Formtastic dependency #104

natebird opened this issue Feb 2, 2011 · 11 comments

Comments

@natebird
Copy link

natebird commented Feb 2, 2011

When I try running the surveyor generator it breaks with the following error:

script/generate surveyor rake db:migrate

/Users/me/.rvm/gems/ruby-1.8.7-p330/.../active_support/dependencies.rb:466:in `load_missing_constant': uninitialized constant Formtastic::SemanticFormBuilder (NameError)
.../.../active_support/dependencies.rb:106:in `const_missing'
.../gems/surveyor-0.19.0/lib/formtastic/surveyor_builder.rb:2
.../.../active_support/dependencies.rb:182:in `require'
.../.../active_support/dependencies.rb:182:in `require'
.../.../active_support/dependencies.rb:547:in `new_constants_in'
.../.../active_support/dependencies.rb:182:in `require'
.../gems/surveyor-0.19.0/lib/surveyor.rb:3
.../gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require'
.../gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require'
.../gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `each'
.../gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `require'
.../gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `each'
.../gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `require'
.../gems/bundler-1.0.10/lib/bundler.rb:120:in `require'
from /Users/me/Sites/me/surveyer/config/boot.rb:119:in `load_gems'
.../gems/rails-2.3.10/lib/initializer.rb:164:in `process'
.../gems/rails-2.3.10/lib/initializer.rb:113:in `send'
.../gems/rails-2.3.10/lib/initializer.rb:113:in `run'
from /Users/me/Sites/me/surveyer/config/environment.rb:9
.../gems/rails-2.3.10/lib/commands/generate.rb:1:in `require'
.../gems/rails-2.3.10/lib/commands/generate.rb:1
from script/generate:3:in `require'
from script/generate:3

I've truncated things for easier readability.

@yoon
Copy link
Member

yoon commented Feb 2, 2011

when you use bundler to install the surveyor gem, haml, fastercsv, and formtastic should be installed as gem dependencies.

@yoon
Copy link
Member

yoon commented Feb 2, 2011

require formtastic. closed by 16acd6f

@yoon
Copy link
Member

yoon commented Feb 2, 2011

I was able to replicate the problem, and we'll release 0.19.1 as a fix.

@natebird
Copy link
Author

natebird commented Feb 2, 2011

Cool. Thanks!

@edgarsilva
Copy link

Hi, I'm still having this issue on Rails3 branch and surveyor v 0.20.0

this version: Using surveyor (0.20.0) from git://github.com/NUBIC/surveyor.git (at rails3)

I have tracked it down to the file surveyor.rb:9 where trying to access Formtastic::SemanticFormHelper.builder = Formtastic::SurveyorBuilder; it seems the require require 'formtastic/surveyor_builder' is not loading the formtastic helper or for some reason I have not figure out yet ignoring it. I have not been able to include the helper manually to see if that fixes the problem, that is what I would try next.

Any Ideas?

@yoon
Copy link
Member

yoon commented Sep 27, 2011

It may be due to an issue with the new version of formtastic - are you
using formtastic 2?

Mark A. Wimbiscus Yoon
Systems Analyst/Programmer Senior
Northwestern University Clinical and Translational Sciences Institute (NUCATS)
312-503-2343
yoon@northwestern.edu
http://www.nucats.northwestern.edu

On Tue, Sep 27, 2011 at 10:44 AM, Edgar O Silva
reply@reply.github.com
wrote:

Hi, I'm still having this issue on Rails3 branch and surveyor v 0.20.0

this version: Using surveyor (0.20.0) from git://github.com/NUBIC/surveyor.git (at rails3)

I have tracked it down to the file surveyor.rb:9 where trying to access Formtastic::SemanticFormHelper.builder = Formtastic::SurveyorBuilder; it seems the require require 'formtastic/surveyor_builder' is not loading the formtastic helper or for some reason I have not figure out yet ignoring it. I have not been able to include the helper manually to see if that fixes the problem, that is what I would try next.

Any Ideas?

Reply to this email directly or view it on GitHub:
#104 (comment)

@edgarsilva
Copy link

Yeap using formtastic 2.0.0 and I also tried with rc5 (it was default on my project) and it also couldn't find the constant, it seems, as you mentioned and issue with extending the SemanticFormBuilder and trying to setup the Formtastic builder to the SurveyorBuilder(I have not found the reason for this).

The default line to setup the builder = FormtasticSurveyorBuilder surveyor.rb:9 throws an unitialized constant error.

Formtastic::SemanticFormHelper.builder = Formtastic::SurveyorBuilder

It seems Formtastic does not know this has been set already, but if you try:

Formtastic::Helpers::SemanticFormHelper.builder = Formtastic::SurveyorBuilder

It says the Constant has already been initialized (Formtastic is not missing constant SemanticFormHelper!) WTF... :-S

Anyways I'm trying to find a solution for this, probably trying to setup the FormHelper.builder attr instead of the semantic one...

What do you think?

@yoon
Copy link
Member

yoon commented Sep 27, 2011

From: https://github.com/justinfrench/formtastic

"It was previously recommended in Formtastic 1.x to subclass
Formtastic::FormBuilder to add your own inputs. This is no longer
recommended in Formtastic 2, and will not work as expected."

For now, you will have to use an earlier version of formtastic, or
rewrite our customizations in the Formtastic 2 separate class style.

Mark A. Wimbiscus Yoon
Systems Analyst/Programmer Senior
Northwestern University Clinical and Translational Sciences Institute (NUCATS)
312-503-2343
yoon@northwestern.edu
http://www.nucats.northwestern.edu

On Tue, Sep 27, 2011 at 11:38 AM, Edgar O Silva
reply@reply.github.com
wrote:

Yeap using formtastic 2.0.0 and I also tried with rc5 (it was default on my project) and it also couldn't find the constant, it seems, as you mentioned and issue with extending the SemanticFormBuilder and trying to setup the Formtastic builder to the SurveyorBuilder(I have not found the reason for this).

The default line to setup the builder = FormtasticSurveyorBuilder surveyor.rb:9 throws an unitialized constant error.

Formtastic::SemanticFormHelper.builder = Formtastic::SurveyorBuilder

It seems Formtastic does not know this has been set already, but if you try:

Formtastic::Helpers::SemanticFormHelper.builder = Formtastic::SurveyorBuilder

It says the Constant has already been initialized (Formtastic is not missing constant SemanticFormHelper!) WTF... :-S

Anyways I'm trying to find a solution for this, probably trying to setup the FormHelper.builder attr instead of the semantic one...

What do you think?

Reply to this email directly or view it on GitHub:
#104 (comment)

@edgarsilva
Copy link

I see... yeah I tried that and did not work as expected... or probably it did since I was expecting it to fail :-)...

Ok Mark sounds fine, I'll give it a try with an older version of Formtastic(any specific version you can recomend that works fine?) and I'm also going to check the Formtastic class style (is this file the SurveyorBuilder definition?), and see if something can be done. Thanks a lot for your help, if I find out anything I'll let you know.

regards

@yoon
Copy link
Member

yoon commented Sep 28, 2011

Edgar,

I don't have a specific version of formtastic to recommend, but
anything in the 1.x line should work.

I'm referring to:

Changing Existing Input Behavior
To modify the behavior of StringInput, subclass it in a new file,
app/inputs/string_input.rb:

at: https://github.com/justinfrench/formtastic

Mark A. Wimbiscus Yoon
Systems Analyst/Programmer Senior
Northwestern University Clinical and Translational Sciences Institute (NUCATS)
312-503-2343
yoon@northwestern.edu
http://www.nucats.northwestern.edu

On Tue, Sep 27, 2011 at 11:56 AM, Edgar O Silva
reply@reply.github.com
wrote:

I see... yeah I tried that and did not work as expected... or probably it did since I was expecting it to fail :-)...

Ok Mark sounds fine, I'll give it a try with an older version of Formtastic(any specific version you can recomend that works fine?) and I'm also going to check the Formtastic class style (is this file the SurveyorBuilder definition?), and see if something can be done. Thanks a lot for your help, if I find out anything I'll let you know.

regards

Reply to this email directly or view it on GitHub:
#104 (comment)

@psamim
Copy link

psamim commented Aug 22, 2014

I encountered the same error here, formtastic 2.2.1.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants