vhochstein / active_scaffold

Rails 4 Version of activescaffold supporting jquery
MIT License
156 stars 34 forks source link

Add Existing Model syntax error #178

Closed samdebutcha closed 13 years ago

samdebutcha commented 13 years ago

active_scaffold/frontends/default/views/add_existing.js.erb:18: syntax error, unexpected kELSE, expecting $end): 15: page << "ActiveScaffold.focus_first_element_of_form('#{element_form_id}');" 16: end 17: <%end%> 18: <%else%> 19: ActiveScaffold.find_action_link('<%element_form_id(:action => :new_existing)%>').close(); 20: <%end%>

when add existing model, I receive Internal Error with the above. I have:

class Section < ActiveRecord::Base has_and_belongs_to_many :articles end class Article < ActiveRecord::Base has_and_belongs_to_many :sections end

with create_table :articles_sections, :id => false do |t| t.belongs_to :section t.belongs_to :article end

vhochstein commented 13 years ago

I ve just pushed a new commit, can you please recheck and please disable backtrace silencers

samdebutcha commented 13 years ago

On 09/01/2011 10:59 AM, vhochstein wrote:

I ve just pushed a new commit, can you please recheck and please disable backtrace silencers

I cloned minutes ago: gem 'jquery-rails_vho', :path => 'tmp/jquery-rails' gem 'verification', :path => 'tmp/verification' gem 'render_component_vho', :path => 'tmp/render_component2' gem 'active_scaffold_vho', :path => 'tmp/active_scaffold2'

changed spec to rails 3.1.0.rc6

bundle install Using render_component_vho (3.1.0.rc1) from source at tmp/render_component2 Using verification (1.0.2) from source at tmp/verification Using active_scaffold_vho (3.1.0) from source at tmp/active_scaffold2

Still getting internal err, code 500 when click on X (close) in nested list form. Other X work fine.

Can I ask how can I change something like: config.new_existing.link.label = '' as I do with config.update.link.label = '' Currently I change nested.rb in order to delete the label.

Thanks a lot, Samson

samdebutcha commented 13 years ago

I uncommented Rails.backtrace_cleaner.remove_silencers! But, still no info in the logger besides the code 500 error.

vhochstein commented 13 years ago

Should be fixed.

samdebutcha commented 13 years ago

Tested with latest master: The Existing model gets added, but form does not close with Internal Error 500, which appears after delay of 5 sec. Then in the log:

Started POST "/admin/as/sections/add_existing?eid=articles_1_sections" for 127.0.0.1 at Sat Sep 03 10:58:30 +0300 2011 Processing by SectionsController#add_existing as JS Parameters: {"eid"=>"articles_1_sections", "commit"=>"Добави", "authenticity_token"=>"Hsm72r0nN+c2WEZP9BRxrXs5yJWKVycQm1703kzF6Sk=", "utf8"=>"✓", "associated_id"=>"5"} User Load (0.5ms) SELECT users.* FROM users WHERE users.id = 1 LIMIT 1 Role Load (0.4ms) SELECT roles.* FROM roles INNER JOIN roles_users ON roles.id = roles_users.role_id WHERE roles_users.user_id = 1 AND roles.name = 'admin' LIMIT 1 Article Load (0.5ms) SELECT articles.* FROM articles WHERE articles.id = 1 LIMIT 1 CACHE (0.0ms) SELECT roles.* FROM roles INNER JOIN roles_users ON roles.id = roles_users.role_id WHERE roles_users.user_id = 1 AND roles.name = 'admin' LIMIT 1 Article::Translation Load (0.4ms) SELECT article_translations.* FROM article_translations WHERE article_translations.article_id = 1 Section Load (0.4ms) SELECT sections.* FROM sections WHERE sections.id = 5 LIMIT 1 (0.1ms) BEGIN (0.2ms) INSERT INTO articles_sections (section_id, article_id) VALUES (5, 1) (37.4ms) COMMIT (0.1ms) BEGIN Article::Translation Load (0.5ms) SELECT article_translations.* FROM article_translations WHERE article_translations.article_id = 1 AND article_translations.locale = 'bg' LIMIT 1 [paperclip] Saving attachments. (0.1ms) COMMIT Section::Translation Load (0.5ms) SELECT section_translations.* FROM section_translations WHERE section_translations.section_id = 5 Sprockets::Environment#path is deprecated /home/dewa/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-3.1.0.rc6/lib/sprockets/helpers/rails_helper.rb:119:in rewrite_asset_path' /home/dewa/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-3.1.0.rc6/lib/action_view/asset_paths.rb:29:in compute_public_path' /home/dewa/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-3.1.0.rc6/lib/sprockets/helpers/rails_helper.rb:100:in compute_public_path' Sprockets::Environment#path is deprecated /home/dewa/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-3.1.0.rc6/lib/sprockets/helpers/rails_helper.rb:119:in rewrite_asset_path' /home/dewa/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-3.1.0.rc6/lib/action_view/asset_paths.rb:29:in compute_public_path' /home/dewa/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-3.1.0.rc6/lib/sprockets/helpers/rails_helper.rb:100:in compute_public_path' SectionTranslation Load (0.6ms) SELECT section_translations.* FROM section_translations WHERE section_translations.section_id = 5 AND (locale != 'bg') Rendered tmp/active_scaffold3/frontends/default/views/_list_record_columns.html.erb (171.0ms) Sprockets::Environment#path is deprecated /home/dewa/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-3.1.0.rc6/lib/sprockets/helpers/rails_helper.rb:119:in rewrite_asset_path' /home/dewa/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-3.1.0.rc6/lib/action_view/asset_paths.rb:29:in compute_public_path' /home/dewa/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-3.1.0.rc6/lib/sprockets/helpers/rails_helper.rb:100:in `compute_public_path' Rendered tmp/active_scaffold3/frontends/default/views/_action_group.html.erb (4.7ms) Rendered tmp/active_scaffold3/frontends/default/views/_list_actions.html.erb (8.3ms) Rendered tmp/active_scaffold3/frontends/default/views/_list_record.html.erb (185.1ms) Rendered tmp/active_scaffold3/frontends/default/views/add_existing.js.erb (8651.7ms) Completed 500 Internal Server Error in 16036ms

ActionView::Template::Error (undefined local variable or method form_stays_open' for #<#<Class:0x9db06b0>:0x9dabf48>): 5: ActiveScaffold.replace('<%=active_scaffold_calculations_id%>', '<%=escape_javascript(render(:partial => 'list_calculations'))%>'); 6: <% end %> 7: 8: <% if(form_stays_open == true)%> 9: <%# why not just re-render the form? that wouldn't utilize a possible do_new override which sets default values.%> 10: ActiveScaffold.reset_form('<%=element_form_id%>'); 11: ActiveScaffold.replace_html('<%=element_messages_id(:action => :add_existing)%>', '<%=escape_javascript(render(:partial => 'form_messages'))%>'); tmp/active_scaffold3/frontends/default/views/add_existing.js.erb:8:in _tmp_active_scaffold__frontends_default_views_add_existing_js_erb___989004827_82654340' actionpack (3.1.0.rc6) lib/action_view/template.rb:144:in send' actionpack (3.1.0.rc6) lib/action_view/template.rb:144:inrender' activesupport (3.1.0.rc6) lib/active_support/notifications.rb:55:in instrument' actionpack (3.1.0.rc6) lib/action_view/template.rb:142:inrender' actionpack (3.1.0.rc6) lib/action_view/renderer/template_renderer.rb:40:in render_template' actionpack (3.1.0.rc6) lib/action_view/renderer/abstract_renderer.rb:33:ininstrument' activesupport (3.1.0.rc6) lib/active_support/notifications.rb:53:in instrument' activesupport (3.1.0.rc6) lib/active_support/notifications/instrumenter.rb:21:ininstrument' activesupport (3.1.0.rc6) lib/active_support/notifications.rb:53:in instrument' actionpack (3.1.0.rc6) lib/action_view/renderer/abstract_renderer.rb:33:ininstrument' actionpack (3.1.0.rc6) lib/action_view/renderer/template_renderer.rb:39:in render_template' actionpack (3.1.0.rc6) lib/action_view/renderer/template_renderer.rb:47:inrender_with_layout' actionpack (3.1.0.rc6) lib/action_view/renderer/template_renderer.rb:38:in render_template' actionpack (3.1.0.rc6) lib/action_view/renderer/template_renderer.rb:12:inrender' actionpack (3.1.0.rc6) lib/action_view/renderer/abstract_renderer.rb:22:in wrap_formats' actionpack (3.1.0.rc6) lib/action_view/renderer/template_renderer.rb:9:inrender' actionpack (3.1.0.rc6) lib/action_view/renderer/renderer.rb:36:in render_template' actionpack (3.1.0.rc6) lib/action_view/renderer/renderer.rb:17:in render_without_active_scaffold'

tmp/active_scaffold3/lib/active_scaffold/extensions/action_view_rendering.rb:96:in render' actionpack (3.1.0.rc6) lib/abstract_controller/rendering.rb:120:in _render_template' actionpack (3.1.0.rc6) lib/action_controller/metal/streaming.rb:250:in _render_template' actionpack (3.1.0.rc6) lib/abstract_controller/rendering.rb:114:in render_to_body' actionpack (3.1.0.rc6) lib/action_controller/metal/renderers.rb:30:in render_to_body' actionpack (3.1.0.rc6) lib/action_controller/metal/compatibility.rb:43:inrender_to_body' actionpack (3.1.0.rc6) lib/abstract_controller/rendering.rb:99:in render' actionpack (3.1.0.rc6) lib/action_controller/metal/rendering.rb:16:in render' actionpack (3.1.0.rc6) lib/action_controller/metal/instrumentation.rb:40:in render_without_active_scaffold' activesupport (3.1.0.rc6) lib/active_support/core_ext/benchmark.rb:5:inms'

Hope this helps.

On 09/02/2011 11:45 PM, vhochstein wrote:

Should be fixed.

vhochstein commented 13 years ago

Ok, next try.. :-)