grimen / validatious-on-rails

Rails plugin that maps model validations to class names on form elements to integrate with Validatious. IMPORTANT: Project is not maintained anymore.
MIT License
345 stars 13 forks source link

stack level too deep #37

Open ayarritu opened 14 years ago

ayarritu commented 14 years ago

Hi,

I believe this issue has come up with another user, and it was closed because it was unreproducible. So, I believe I am reopening the issue.

I am running ruby 1.8.7 with rails 2.3.5, and have installed the validatious gem (0.4.8, from gemcutter), the validation_reflection plugin (0.3.6), and the formtastic gem (0.9.7). However, when I enable the validatious gem, I get the following error (posted at the end of this message).

There are several points I don't understand. First, why is it that validatious is being called when I have not explicitly called ":class => 'validate'" in "form_for". My understanding is that the form is only validated when the form is called with the class "validate". I would have thought validatious would be totally ignored. Second, I don't know why it is failing. I do know that if I comment out the "f.text_area..." field, then the problem goes away. However, this is obviously not a solution.

Any help will be appreciated! This is my first time using validatious, so the problem is mostly likely my setup.

Kevin

stack level too deep Extracted source (around line #7):

4:

<%= formatting_note %>


5: <% form_for :comment, :url => person_comments_path(@person) do |f| %> 6:
7: <%= f.text_area :body, :rows => 2, :cols => 80 %> 8:
9:
10: <%= submit_tag "Submit", :class => "button" %> Trace of template inclusion: app/views/people/show.html.erb

RAILS_ROOT: /Users/kevinyarritu/projects/nektere/insoshi-private

Application Trace | Framework Trace | Full Trace /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:195:in normalize_translation_keys' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:195:inmap' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:195:in normalize_translation_keys' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:101:insend' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:101:in lookup' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:33:intranslate' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:165:in t' /Library/Ruby/Gems/1.8/gems/validatious-on-rails-0.4.8/lib/validatious-on-rails/validatious/validator.rb:206:ingenerate_message' /Library/Ruby/Gems/1.8/gems/validatious-on-rails-0.4.8/lib/validatious-on-rails/validatious/validators/length/maximum_validator.rb:11:in initialize' /Library/Ruby/Gems/1.8/gems/validatious-on-rails-0.4.8/lib/validatious-on-rails/model_validations.rb:255:innew' /Library/Ruby/Gems/1.8/gems/validatious-on-rails-0.4.8/lib/validatious-on-rails/model_validations.rb:255:in length_of' /Library/Ruby/Gems/1.8/gems/validatious-on-rails-0.4.8/lib/validatious-on-rails/model_validations.rb:104:insend' /Library/Ruby/Gems/1.8/gems/validatious-on-rails-0.4.8/lib/validatious-on-rails/model_validations.rb:104:in from_active_record' /Library/Ruby/Gems/1.8/gems/validatious-on-rails-0.4.8/lib/validatious-on-rails/model_validations.rb:86:ineach' /Library/Ruby/Gems/1.8/gems/validatious-on-rails-0.4.8/lib/validatious-on-rails/model_validations.rb:86:in from_active_record' /Library/Ruby/Gems/1.8/gems/validatious-on-rails-0.4.8/lib/validatious-on-rails/model_validations.rb:42:inoptions_for' /Library/Ruby/Gems/1.8/gems/validatious-on-rails-0.4.8/lib/validatious-on-rails/helpers.rb:13:in attach_validator_for' /Library/Ruby/Gems/1.8/gems/validatious-on-rails-0.4.8/lib/validatious-on-rails/helpers.rb:48:intext_area_without_validation' /Library/Ruby/Gems/1.8/gems/validatious-on-rails-0.4.8/lib/validatious-on-rails/helpers.rb:48:in send' /Library/Ruby/Gems/1.8/gems/validatious-on-rails-0.4.8/lib/validatious-on-rails/helpers.rb:48:intext_area_with_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/app/views/people/_wall.html.erb:7:in _run_erb_app47views47people47_wall46html46erb_locals_object_wall' /Users/kevinyarritu/projects/nektere/insoshi-private/app/views/people/_wall.html.erb:5:in_run_erb_app47views47people47_wall46html46erb_locals_object_wall' /Users/kevinyarritu/projects/nektere/insoshi-private/app/views/people/show.html.erb:7:in _run_erb_app47views47people47show46html46erb' /Users/kevinyarritu/projects/nektere/insoshi-private/app/views/people/show.html.erb:39:in_run_erb_app47views47people47show46html46erb' /Users/kevinyarritu/projects/nektere/insoshi-private/app/helpers/application_helper.rb:173:in column_div' /Users/kevinyarritu/projects/nektere/insoshi-private/app/views/people/show.html.erb:2:in_run_erb_app47views47people47show46html46erb' /Users/kevinyarritu/projects/nektere/insoshi-private/app/controllers/people_controller.rb:52:in `show'

ewerkman commented 14 years ago

I am having the same problem. Any help on this?

Erwin

ayarritu commented 14 years ago

Hi Jonas,

even though I posted this message awhile ago, recently I have tried to debug this and have made some progress. As I stated before, the problem occurs when executing the statement

7: <%= f.text_area :body, :rows => 2, :cols => 80 %>

When this statement is executed, the method "#{field_type}_with_validation" is executed in ./validatious-on-rails/helpers.rb (where "field_type" in this case is "text_area"). This method is the following

define_method :"#{field_type}_with_validation" do |_args| args, tail = ::ValidatiousOnRails::Helpers.extract_args!(_args) options = self.attach_validator_for(args.first, args.second, args.extract_options!) self.send :"#{field_type}_without_validation", *((args << options) + tail) end alias_method_chain field_type, :validation

I believe that the proper execution of this statement is simply to add validation information to any FormHelper field, and then to execute the rails defined method for the field. However, what is happening is that it is getting caught in an infinite loop (part of the framework trace is at the bottom of this message). Upon execution, the line

self.send :"#{field_type}_without_validation", *((args << options) + tail)

is executing the method "#{field_type}_with_validation" once again. It does this every time, hence the infinite loop. Again, according to the "alias_method_chain" method, I believe this line is supposed to instead execute the rails defined f.text_area method.

I would just like to know how to solve this problem. Any help on this would be greatly appreciated. If you need any more information, just let me know.

thanks, Kevin

/Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in text_area_without_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:insend' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in text_area_with_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:intext_area_without_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in send' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:intext_area_with_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in text_area_without_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:insend' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in text_area_with_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:intext_area_without_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in send' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:intext_area_with_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in text_area_without_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:insend' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in text_area_with_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:intext_area_without_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in send' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:intext_area_with_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in text_area_without_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:insend' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in text_area_with_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:intext_area_without_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in send' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:intext_area_with_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in text_area_without_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:insend' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in text_area_with_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:intext_area_without_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:in send' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/plugins/validatious-on-rails/lib/validatious-on-rails/helpers.rb:47:intext_area_with_validation' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb:990:in text_area' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb:990:insend' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb:990:in text_area' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb:512:infields_for' /Users/kevinyarritu/projects/nektere/insoshi-private/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb:282:in `form_for'

grimen commented 14 years ago

This project is since November '09 on ice, and I'm not sure when or if I'll get time to get into it again. :/