# TypeError: Effect\[effect\_class\] when using block form of link\_to helper

**URL:** <https://www.ruby-forum.com/t/typeerror-effect-effect-class-when-using-block-form-of-link-to-helper/122714>\
**Category:** Rails\
**Created:** [December 11, 2007, 5:27am UTC](https://www.ruby-forum.com/t/typeerror-effect-effect-class-when-using-block-form-of-link-to-helper/122714 "2007-12-11T05:27:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![acampos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@acampos](https://www.ruby-forum.com/u/acampos)\
**Post date:** [December 11, 2007, 5:27am UTC](https://www.ruby-forum.com/t/typeerror-effect-effect-class-when-using-block-form-of-link-to-helper/122714/1 "2007-12-11T05:27:26Z")

</div>

Anyone have any idea why I’m getting this error when using the block  
form of the link\_to helper in Rails 2.0.1? I’m essentially using the  
exact same code as in the Rails doc example, but no luck. Any help  
would be appreciated.

---

<div class="post-metadata">

**Author:** ![acampos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@acampos](https://www.ruby-forum.com/u/acampos)\
**Post date:** [December 11, 2007, 6:12am UTC](https://www.ruby-forum.com/t/typeerror-effect-effect-class-when-using-block-form-of-link-to-helper/122714/2 "2007-12-11T06:12:25Z")

</div>

Sorry, meant link\_to\_function, not link\_to.

---

<div class="post-metadata">

**Author:** ![acampos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@acampos](https://www.ruby-forum.com/u/acampos)\
**Post date:** [December 11, 2007, 6:23am UTC](https://www.ruby-forum.com/t/typeerror-effect-effect-class-when-using-block-form-of-link-to-helper/122714/3 "2007-12-11T06:23:34Z")

</div>

Could you show us the exact code you’re using please?

On Dec 11, 2007 1:31 PM, bigbanger [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Sorry, meant link\_to\_function, not link\_to.
> 
> On Dec 10, 6:53 pm, bigbanger [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Anyone have any idea why I’m getting this error when using the block  
> > form of the link\_to helper in Rails 2.0.1? I’m essentially using the  
> > exact same code as in the Rails doc example, but no luck. Any help  
> > would be appreciated.

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

---

<div class="post-metadata">

**Author:** ![acampos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@acampos](https://www.ruby-forum.com/u/acampos)\
**Post date:** [December 11, 2007, 6:44am UTC](https://www.ruby-forum.com/t/typeerror-effect-effect-class-when-using-block-form-of-link-to-helper/122714/4 "2007-12-11T06:44:01Z")

</div>

Ryan,

I’m using the following code in my .rhtml file:

\<%=  
link\_to\_function(“show”, nil, :id =\> “more\_link”, :class =\>  
“expand\_collapse”) do |page|  
page[:user\_listings].visual\_effect :toggle\_appear  
page[:more\_link].replace\_html “hide”  
end  
%\>

---

<div class="post-metadata">

**Author:** ![acampos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@acampos](https://www.ruby-forum.com/u/acampos)\
**Post date:** [December 11, 2007, 8:44am UTC](https://www.ruby-forum.com/t/typeerror-effect-effect-class-when-using-block-form-of-link-to-helper/122714/5 "2007-12-11T08:44:02Z")

</div>

I should have mentioned that ‘user\_listings’ is the id of a div  
defined on my page.

---

<div class="post-metadata">

**Author:** ![acampos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@acampos](https://www.ruby-forum.com/u/acampos)\
**Post date:** [December 11, 2007, 9:31am UTC](https://www.ruby-forum.com/t/typeerror-effect-effect-class-when-using-block-form-of-link-to-helper/122714/6 "2007-12-11T09:31:28Z")

</div>

I was not aware you could use link\_to\_function as a block.

It has something to do with your :toggle\_appear custom function at a  
guess.

link\_to\_function(“show”, nil, { :id =\> “more\_link”, :class =\>  
“expand\_collapse” } )

On Dec 11, 2007 1:53 PM, bigbanger [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > ```
> > link_to_function("show", nil, :id => "more_link", :class =>
> > 
> > ```
> > 
> > > On Dec 11, 2007 1:31 PM, bigbanger [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > > 
> > > > > would be appreciated.
> > 
> > > –  
> > > Ryan B.[http://www.frozenplague.net](http://www.frozenplague.net)

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

---

<div class="post-metadata">

**Author:** ![acampos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@acampos](https://www.ruby-forum.com/u/acampos)\
**Post date:** [December 11, 2007, 1:13pm UTC](https://www.ruby-forum.com/t/typeerror-effect-effect-class-when-using-block-form-of-link-to-helper/122714/7 "2007-12-11T13:13:32Z")

</div>

It’s in the Rails docs here:  
[ActionView::Helpers::JavaScriptHelper](http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptHelper.html#M001048).  
Specifically, this part:

“The function argument can be omitted in favor of an update\_page  
block, which evaluates to a string when the template is rendered  
(instead of making an Ajax request first).”

Followed by an example similar to the one I posted.

---

<div class="post-metadata">

**Author:** ![acampos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@acampos](https://www.ruby-forum.com/u/acampos)\
**Post date:** [December 11, 2007, 1:20pm UTC](https://www.ruby-forum.com/t/typeerror-effect-effect-class-when-using-block-form-of-link-to-helper/122714/8 "2007-12-11T13:20:33Z")

</div>

- It has something to do with your :toggle\_appear custom function at a  
guess.
- 

AFAIK, there is no toggle\_appear visual effect. It’s either toggle, or  
appear. Not both.

On Dec 11, 2007 2:09 PM, Ryan B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > block, which evaluates to a string when the template is rendered
> > 
> > > link\_to\_function(“show”, nil, { :id =\> “more\_link”, :class =\>
> > > 
> > > > > ```
> > > > > end
> > > > > 
> > > > > ```
> > > 
> > > > > > > > would be appreciated.  
> > > > > > > > –  
> > > > > > > > Ryan B.  
> > > > > > > > [http://www.frozenplague.net](http://www.frozenplague.net)

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

---

<div class="post-metadata">

**Author:** ![acampos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@acampos](https://www.ruby-forum.com/u/acampos)\
**Post date:** [December 11, 2007, 1:17pm UTC](https://www.ruby-forum.com/t/typeerror-effect-effect-class-when-using-block-form-of-link-to-helper/122714/9 "2007-12-11T13:17:03Z")

</div>

On Dec 11, 2007 2:04 PM, bigbanger [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Followed by an example similar to the one I posted.
> 
> > On Dec 11, 2007 1:53 PM, bigbanger [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > 
> > > > On Dec 10, 7:02 pm, “Ryan B.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > > > 
> > > > > > > form of the link\_to helper in Rails 2.0.1? I’m essentially  
> > > > > > > Ryan B.[http://www.frozenplague.net](http://www.frozenplague.net)

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!
