---
title: "Active Scaffold and JRails/jQuery"
author: "myrev"
date: "2010-07-29T19:58:43Z"
tags: []
categories: ["编程语言"]
slug: "active-scaffold-and-jrails-jquery"
draft: false
lastmod: "2010-07-29T19:59:18Z"
id: 724723
url: "https://myrev.iteye.com/blog/724723"
---

To use Active with scaffold with JRails you have to use a different

 JQUERY_VAR than $

In our controllers


1.  set
 
```java
ActionView::Helpers::PrototypeHelper::JQUERY_VAR = ‘jQuery’

```

or 

```java
ActionView::Helpers::PrototypeHelper.const_set(:JQUERY_VAR, 'jQuery')

```

2.  in your layout load both prototype and jquery


```java
<%= javascript_include_tag ‘prototype’, ‘effects’, ‘jquery’ %>

```

3. Lastly, make sure to tell jQuery to not conflict with Prototype over $ in your Javascript:

application.html.erb

```java

  <script type="text/javascript">
      jQuery.noConflict();
    </script>
```



Now, you should use "jQuery()" instead of "$()".

eg:

```java

jQuery("#id").hide()

```


http://errtheblog.com/posts/73-the-jskinny-on-jquery