Hello... I''m having a stack level too deep error using Ruby 1.8.7 with Rails 3.0.4 and with the rails console I performed the following commands. leo%>rails console Loading development environment (Rails 3.0.4) ruby-1.8.7-head > leo = Organization.find(1) SystemStackError: stack level too deep from /app/models/organization.rb:105:in `parents'' Here is the object that is having issues.. class Organization < ActiveRecord::Base has_many :group_organizations, :dependent => :delete_all has_many :groups, :through => :group_organizations has_many :orders has_many :product_contracts has_many :people accepts_nested_attributes_for :people has_many :addresses accepts_nested_attributes_for :addresses has_many :organizations has_many :departments has_many :organization_credits has_many :documents validates_presence_of :name def self.parents #@organizations = self.find :all, :conditions => [''is_company = ? '',true] @organizations = Organization.where("is_company = ?",true) #@organization_parents = [] select_choice = I18n.t("select") + " "+ I18n.t("segments.description") @organization_parents = [select_choice] for organization in @organizations @organization_parents << [organization.name, organization.id] end return @organization_parents end -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Stack Level too deep means there is some function recursing, probably forever. Looking over your code real quick I''ve seen the :has_many organizations which probably leads to the recursion. When trying to get the parents, Rails will get the Parents of the Parents and so on since it is a property of the Organization so I guess it is not lazy evaluated. Maybe that helps... On 2011-03-26 22:25:00 +0100, rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wrote:>Hello... > >I''m having a stack level too deep error using Ruby 1.8.7 with Rails >3.0.4 and with the rails console I performed the following commands. > >leo%>rails console >Loading development environment (Rails 3.0.4) >ruby-1.8.7-head > leo = Organization.find(1) > >SystemStackError: stack level too deep >from /app/models/organization.rb:105:in `parents'' > > >Here is the object that is having issues.. > > >class Organization < ActiveRecord::Base > > has_many :group_organizations, :dependent => >:delete_all > has_many :groups, :through => :group_organizations > > has_many :orders > has_many :product_contracts > > has_many :people > accepts_nested_attributes_for :people > > has_many :addresses > accepts_nested_attributes_for :addresses > > has_many :organizations > has_many :departments > has_many :organization_credits > > has_many :documents > > validates_presence_of :name > > > > def self.parents > #@organizations = self.find :all, :conditions => [''is_company = ? >'',true] > @organizations = Organization.where("is_company = ?",true) > #@organization_parents = [] > select_choice = I18n.t("select") + " "+ >I18n.t("segments.description") > @organization_parents = [select_choice] > for organization in @organizations > @organization_parents << [organization.name, organization.id] > end > return @organization_parents > end > >-- >Posted via http://www.ruby-forum.com/. > >-- >You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. >To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. >For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Philipp Fehre wrote in post #989443:> Stack Level too deep means there is some function recursing, probably > forever. Looking over your code real quick I''ve seen the :has_many > organizations which probably leads to the recursion. When trying to get > the parents, Rails will get the Parents of the Parents and so on since > it is a property of the Organization so I guess it is not lazy > evaluated. Maybe that helps... > > > On 2011-03-26 22:25:00 +0100, rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wrote:Thanks Philipp.. I commented the has_many :organizations sentence but it still keeps showing the errors... The issue in my code comes from this place def self.parents>>> @organizations = Organization.where("is_company = ?",true)I guess it keeps asking itself about the companies which are companies within the same table... What do you think? Leo -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 26 March 2011 23:10, Leobardo C. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> The issue in my code comes from this > place > > def self.parents >>>> @organizations = Organization.where("is_company = ?",true) > > I guess it keeps asking itself about the companies which are companies > within the same table... What do you think?yep... and "self" is one of those companies, so it keeps looping... Add a condition to exclude the current record: @organizations = Organization.where(["is_company = ? AND id <> ?",true, self.id]) (or whatever it takes - I''m not into Rails 3 yet... too much old 2.x stuff to do!) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 26 March 2011 23:34, Michael Pavling <pavling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> yep... and "self" is one of those companies, so it keeps looping...Ignore me... I see that''s a class method, so won''t have an instance id... -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 26 March 2011 23:10, Leobardo C. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> def self.parents >>>> @organizations = Organization.where("is_company = ?",true) > > I guess it keeps asking itself about the companies which are companies > within the same table... What do you think?I assume that the "parents" method returns all the Organizations which have child organisations? If so, you''re using this method instead of a scope? Can''t you do something along the lines of the pseudo-SQL below: SELECT * FROM organisations WHERE organisations.id IN (SELECT parent_id FROM organisations GROUP BY parent_id) If you can get it working in SQL, you can turn it into a scope. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Yes so you can''t just exclude the current, I''m not sure but I still think that it comes from the fact that each company has_many companies relationship which leads to the recursion. This shows up on the first place where you are looking up a company to be resolved to an object. Since the class has the property parents this is trying to be resolved and therefor the line asking for Organization.where(...) shows up as the error. My guess at least... On 2011-03-27 00:38:08 +0100, rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wrote:>On 26 March 2011 23:34, Michael Pavling <pavling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> yep... and "self" is one of those companies, so it keeps looping... > >Ignore me... I see that''s a class method, so won''t have an instance id... > >-- >You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. >To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. >For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 26 March 2011 23:44, Philipp Fehre <philipp.fehre-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Yes so you can''t just exclude the current, I''m not sure but I still think that it comes from the fact that each company has_many companies relationship which leads to the recursion. This shows up on the first place where you are looking up a company to be resolved to an object. Since the class has the property parents this is trying to be resolved and therefor the line asking for Organization.where(...) shows up as the error. My guess at least...There could be recursion there if any record has one of its descendents as its parent, but the OP said he commented it and still had the problem... so it''s probably not what''s causing this issue right now. I wonder about what the "parents" functionality is for... if it''s to allow the model to act as a nested set, I''d be inclined to use a Gem that adds that ability, rather than rolling my own...> > On 2011-03-27 00:38:08 +0100, rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wrote: > >>On 26 March 2011 23:34, Michael Pavling <pavling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> yep... and "self" is one of those companies, so it keeps looping... >> >>Ignore me... I see that''s a class method, so won''t have an instance id... >> >>-- >>You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. >>To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. >>For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
SystemStackError in Issues#show Showing app/views/issues/show.rhtml where line #28 raised: stack level too deep Extracted source (around line #28): 25: <th class="due-date"><%=l(:field_due_date)%>:</th><td class="due-date"><%= format_date(@issue.due_date) %></td> 26: </tr> 27: <tr> 28: <th class="assigned-to"><%=l(:field_assigned_to)%>:</th><td class="assigned-to"><%= avatar(@issue.assigned_to, :size => "14") %><%@issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td> 29: <th class="progress"><%=l(:field_done_ratio)%>:</th><td class="progress"><%= progress_bar @issue.done_ratio, :width => ''80px'', :legend => "#{@issue.done_ratio}%" %></td> 30: </tr> 31: <tr> RAILS_ROOT: /home/hkakada/rails_apps/redmine Application Trace | Framework Trace | Full Trace /home/hkakada/rails_apps/redmine/vendor/plugins/redmine_local_avatars-0.1.1/lib/application_helper_avatar_patch.rb:30:in `avatar_without_local'' /home/hkakada/rails_apps/redmine/vendor/plugins/redmine_local_avatars-0.1.1/lib/application_helper_avatar_patch.rb:38:in `avatar'' /home/hkakada/rails_apps/redmine/app/views/issues/show.rhtml:28:in `_run_rhtml_app47views47issues47show46rhtml'' /home/hkakada/rails_apps/redmine/app/controllers/issues_controller.rb:117:in `show'' /home/hkakada/rails_apps/redmine/app/controllers/issues_controller.rb:116:in `show'' /home/hkakada/rails_apps/redmine/vendor/plugins/redmine_local_avatars-0.1.1/lib/application_helper_avatar_patch.rb:30:in `avatar_without_local'' /home/hkakada/rails_apps/redmine/vendor/plugins/redmine_local_avatars-0.1.1/lib/application_helper_avatar_patch.rb:38:in `avatar'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/renderable.rb:34:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/renderable.rb:34:in `render'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:306:in `with_template'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/renderable.rb:30:in `render'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/template.rb:205:in `render_template'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:265:in `render'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:348:in `_render_with_layout'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:262:in `render'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1250:in `render_for_file'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:945:in `render_without_benchmark'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:51:in `render'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `ms'' /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `ms'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:51:in `render'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:135:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:135:in `custom'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:179:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:179:in `respond'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:173:in `each'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:173:in `respond'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:107:in `respond_to'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1331:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1331:in `perform_action_without_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:617:in `call_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `ms'' /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `ms'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/flash.rb:146:in `perform_action'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `process_without_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:606:in `process'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:391:in `process'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:386:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:437:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:87:in `dispatch'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:121:in `_call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in `call'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in `call'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:9:in `cache'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:28:in `call'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/string_coercion.rb:25:in `call'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/head.rb:9:in `call'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/methodoverride.rb:24:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/params_parser.rb:15:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/session/cookie_store.rb:93:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:in `call'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `synchronize'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:114:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:34:in `run'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:in `call'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/content_length.rb:13:in `call'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/fastcgi.rb:58:in `serve'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:103:in `process_request'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:153:in `with_signal_handler'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:101:in `process_request'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:78:in `process_each_request'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:77:in `each'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:77:in `process_each_request'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:76:in `catch'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:76:in `process_each_request'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:51:in `process!'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:23:in `process!'' dispatch.fcgi:24 /home/hkakada/rails_apps/redmine/vendor/plugins/redmine_local_avatars-0.1.1/lib/application_helper_avatar_patch.rb:30:in `avatar_without_local'' /home/hkakada/rails_apps/redmine/vendor/plugins/redmine_local_avatars-0.1.1/lib/application_helper_avatar_patch.rb:38:in `avatar'' /home/hkakada/rails_apps/redmine/app/views/issues/show.rhtml:28:in `_run_rhtml_app47views47issues47show46rhtml'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/renderable.rb:34:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/renderable.rb:34:in `render'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:306:in `with_template'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/renderable.rb:30:in `render'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/template.rb:205:in `render_template'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:265:in `render'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:348:in `_render_with_layout'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:262:in `render'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1250:in `render_for_file'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:945:in `render_without_benchmark'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:51:in `render'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `ms'' /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `ms'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:51:in `render'' /home/hkakada/rails_apps/redmine/app/controllers/issues_controller.rb:117:in `show'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:135:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:135:in `custom'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:179:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:179:in `respond'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:173:in `each'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:173:in `respond'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:107:in `respond_to'' /home/hkakada/rails_apps/redmine/app/controllers/issues_controller.rb:116:in `show'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1331:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1331:in `perform_action_without_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:617:in `call_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `ms'' /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `ms'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/flash.rb:146:in `perform_action'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `process_without_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:606:in `process'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:391:in `process'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:386:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:437:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:87:in `dispatch'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:121:in `_call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in `call'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in `call'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:9:in `cache'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:28:in `call'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/string_coercion.rb:25:in `call'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/head.rb:9:in `call'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/methodoverride.rb:24:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/params_parser.rb:15:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/session/cookie_store.rb:93:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:in `call'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `synchronize'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:114:in `call'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:34:in `run'' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:in `call'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/content_length.rb:13:in `call'' /usr/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/fastcgi.rb:58:in `serve'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:103:in `process_request'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:153:in `with_signal_handler'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:101:in `process_request'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:78:in `process_each_request'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:77:in `each'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:77:in `process_each_request'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:76:in `catch'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:76:in `process_each_request'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:51:in `process!'' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/fcgi_handler.rb:23:in `process!'' dispatch.fcgi:24 Request Parameters: {"id"=>"142"} Show session dump --- Response Headers: {"Content-Type"=>"text/html", "Cache-Control"=>"no-cache"} I use redmine 1.1.2 Please help me Thanks Attachments: http://www.ruby-forum.com/attachment/6087/redmine_error.jpg -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 28, 11:26 pm, "Menglim S." <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> SystemStackError in Issues#show > > Showing app/views/issues/show.rhtml where line #28 raised: > > stack level too deep > > Extracted source (around line #28): > > 25: <th class="due-date"><%=l(:field_due_date)%>:</th><td > class="due-date"><%= format_date(@issue.due_date) %></td> > 26: </tr> > 27: <tr> > 28: <th class="assigned-to"><%=l(:field_assigned_to)%>:</th><td > class="assigned-to"><%= avatar(@issue.assigned_to, :size => "14") %><%> @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td> > 29: <th class="progress"><%=l(:field_done_ratio)%>:</th><td > class="progress"><%= progress_bar @issue.done_ratio, :width => ''80px'', > :legend => "#...@issue.done_ratio}%" %></td> > 30: </tr> > 31: <tr> > > RAILS_ROOT: /home/hkakada/rails_apps/redmine > Application Trace | Framework Trace | Full Trace > > /home/hkakada/rails_apps/redmine/vendor/plugins/redmine_local_avatars-0.1.1 /lib/application_helper_avatar_patch.rb:30:in > `avatar_without_local'' > /home/hkakada/rails_apps/redmine/vendor/plugins/redmine_local_avatars-0.1.1 /lib/application_helper_avatar_patch.rb:38:in > `avatar''I tracked down the source for redmine_local_avatars, and it uses alias_method_chain to mix-in the local functionality. The stack error you''re seeing is a classic symptom of something getting double-aliased and recursing indefinitely; you''ll want to check your code to see if something else is including ApplicationHelperAvatarPatch. --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling wrote in post #989454:> On 26 March 2011 23:10, Leobardo C. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> def self.parents >>>>> @organizations = Organization.where("is_company = ?",true) >> >> I guess it keeps asking itself about the companies which are companies >> within the same table... What do you think? > > I assume that the "parents" method returns all the Organizations which > have child organisations? > > If so, you''re using this method instead of a scope? > Can''t you do something along the lines of the pseudo-SQL below: > > SELECT * FROM organisations WHERE organisations.id IN (SELECT > parent_id FROM organisations GROUP BY parent_id) > > If you can get it working in SQL, you can turn it into a scope.Find the solution dude. It was an scope as you did.. Here is my answer for anyone there facing the same problem. ===================================================================== I''ve found the solution to this issue... I''m using Rails 3 and my class looks like this (and the problematic methods was this too) class Organization < ActiveRecord::Base . . . . def self.parents @organizations = self.find :all, :conditions => [''is_company = ? '',true] select_choice = I18n.t("select") + " "+ I18n.t("segments.description") @organization_parents = [select_choice] for organization in @organizations @organization_parents << [organization.name, organization.id] end return @organization_parents end I did have to hack a lot in the code to find out something was wrong with the named_scope on the line @organizations = self.find :all, :conditions => [''is_company = ? '',true] So I had to change it to something like this @organizations = Organization.where("is_company = ?",true) But it was wrong too.. So I decided to add an scope for this below the class name so the final code looks like this: class Organization < ActiveRecord::Base . . . scope :company, where("is_company = ?",true) def self.parents @organizations = self.company select_choice = I18n.t("select") + " "+ I18n.t("segments.description") @organization_parents = [select_choice] for organization in @organizations @organization_parents << [organization.name, organization.id] end return @organization_parents end So using this line with the scope @organizations = self.company it worked flawlessly in every part of the code. I was wondering if the named_scope is deprecated when using class methods or they are not supported from now and throws an error and not a warning before Thanks for your help Leo -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.