# HABTM causes LocalJumpError in Controller : no block given error

**URL:** <https://www.ruby-forum.com/t/habtm-causes-localjumperror-in-controller-no-block-given-error/122807>\
**Category:** Rails\
**Created:** [December 12, 2007, 12:34pm UTC](https://www.ruby-forum.com/t/habtm-causes-localjumperror-in-controller-no-block-given-error/122807 "2007-12-12T12:34:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DEfusion](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e68b1a/32.png) [@DEfusion](https://www.ruby-forum.com/u/DEfusion)\
**Post date:** [December 12, 2007, 12:34pm UTC](https://www.ruby-forum.com/t/habtm-causes-localjumperror-in-controller-no-block-given-error/122807/1 "2007-12-12T12:34:17Z")

</div>

I have projects and users which have a many to many relationship, in  
one of my controllers I am doing the following:

@projects = @user.projects.find\_all()

Whenever there is data in the projects\_users I get the following  
error:

LocalJumpError in DashboardController#index

no block given

e:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active\_record/  
base.rb:1529:in `find_all' e:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/ associations/association_proxy.rb:124:in`each’  
e:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active\_record/  
associations/association\_proxy.rb:124:in `find_all' e:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/ associations/association_proxy.rb:124:in`send’  
e:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active\_record/  
associations/association\_proxy.rb:124:in `method_missing' e:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active_record/ associations/association_collection.rb:162:in`method\_missing’  
app/controllers/dashboard\_controller.rb:7:in `index' -e:2:in`load’  
-e:2

I’ve been through the debugger and I can see that the expected data is  
being picked up active record but I can’t quite see where this error  
comes from and it’s got me stumped.

Any ideas?

---

<div class="post-metadata">

**Author:** ![DEfusion](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e68b1a/32.png) [@DEfusion](https://www.ruby-forum.com/u/DEfusion)\
**Post date:** [December 12, 2007, 12:47pm UTC](https://www.ruby-forum.com/t/habtm-causes-localjumperror-in-controller-no-block-given-error/122807/2 "2007-12-12T12:47:12Z")

</div>

On 12 Dec 2007, at 11:27, DEfusion wrote:

> I have projects and users which have a many to many relationship, in  
> one of my controllers I am doing the following:
> 
> @projects = @user.projects.find\_all()
> 
> Whenever there is data in the projects\_users I get the following  
> error:

Does it work if you use the non deprecated call ( find :all) ?

Fred

---

<div class="post-metadata">

**Author:** ![DEfusion](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e68b1a/32.png) [@DEfusion](https://www.ruby-forum.com/u/DEfusion)\
**Post date:** [December 12, 2007, 12:54pm UTC](https://www.ruby-forum.com/t/habtm-causes-localjumperror-in-controller-no-block-given-error/122807/3 "2007-12-12T12:54:14Z")

</div>

It does, thanks for that I was beginning to think I was going mad.  
Guess I need to swat up on what’s been deprecated.

Cheers,

-D

On Dec 12, 11:38 am, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
