# Rails and Dojo

**URL:** <https://www.ruby-forum.com/t/rails-and-dojo/134677>\
**Category:** Rails\
**Created:** [April 13, 2008, 10:07pm UTC](https://www.ruby-forum.com/t/rails-and-dojo/134677 "2008-04-13T22:07:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Schalk\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@Schalk\_N](https://www.ruby-forum.com/u/Schalk_N)\
**Post date:** [April 13, 2008, 10:07pm UTC](https://www.ruby-forum.com/t/rails-and-dojo/134677/1 "2008-04-13T22:07:53Z")

</div>

Hi there everyone,

How would I go about adding the dojoType to a rails text\_area form  
helper i.e.

\<%= f.text\_area :content %\>

Regards,  
Schalk

---

<div class="post-metadata">

**Author:** ![Schalk\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@Schalk\_N](https://www.ruby-forum.com/u/Schalk_N)\
**Post date:** [April 13, 2008, 10:23pm UTC](https://www.ruby-forum.com/t/rails-and-dojo/134677/2 "2008-04-13T22:23:42Z")

</div>

Not 100% sure since I’ve never tried Rails + Dojo, but as I recall  
don’t most of the tags allow for additional HTML content to be  
specified as a Hash? If so, couldn’t you pass the dojoType attribute  
and value to that?

As I said I’ve never tried this, so it might not work depending on how  
exactly the internals of Rails parses the values provided

- Wayne

---

<div class="post-metadata">

**Author:** ![Schalk\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@Schalk\_N](https://www.ruby-forum.com/u/Schalk_N)\
**Post date:** [April 13, 2008, 10:28pm UTC](https://www.ruby-forum.com/t/rails-and-dojo/134677/3 "2008-04-13T22:28:30Z")

</div>

I Wayne,

Thank for the feedback. Yes, I saw that all the form helpers do show a  
options = {} argument but when I try to do:

\<%= f.text\_area :content, options = {dooType=“someDojoType”} %\>

I get a compile error. Can you show me what you mean by specifying  
additional HTML content as a Hash?

Kind Regards,  
Schalk N.

---

<div class="post-metadata">

**Author:** ![Schalk\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@Schalk\_N](https://www.ruby-forum.com/u/Schalk_N)\
**Post date:** [April 14, 2008, 1:29am UTC](https://www.ruby-forum.com/t/rails-and-dojo/134677/4 "2008-04-14T01:29:23Z")

</div>

\<%= f.text\_area :content, :dooType =\> “someDojoType”, :id =\>  
“element\_id” %\>

Schalk N. wrote:

> I Wayne,
> 
> Thank for the feedback. Yes, I saw that all the form helpers do show a  
> options = {} argument but when I try to do:
> 
> \<%= f.text\_area :content, options = {dooType=“someDojoType”} %\>
> 
> I get a compile error. Can you show me what you mean by specifying  
> additional HTML content as a Hash?
> 
> Kind Regards,  
> Schalk N.

---

<div class="post-metadata">

**Author:** ![Schalk\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@Schalk\_N](https://www.ruby-forum.com/u/Schalk_N)\
**Post date:** [April 14, 2008, 2:03am UTC](https://www.ruby-forum.com/t/rails-and-dojo/134677/5 "2008-04-14T02:03:16Z")

</div>

Ummmm I think he wanted the dooType attribute set on the text area  
tax, not sent in through the params attribute (ie on the key-val  
mappings of the URL line).

that would be

\<%= f.text\_area(:content, {:dooType =\> “someDojoType”}) %\>

Here “content” would be the attribute of the object passed into the  
form object “f”.

Is this what you wanted?

Julian.

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)  
VIDEO #4 coming soon!  
[http://sensei.zenunit.com/](http://sensei.zenunit.com/)

---

<div class="post-metadata">

**Author:** ![Schalk\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@Schalk\_N](https://www.ruby-forum.com/u/Schalk_N)\
**Post date:** [April 14, 2008, 2:52am UTC](https://www.ruby-forum.com/t/rails-and-dojo/134677/6 "2008-04-14T02:52:55Z")

</div>

Yep.

Julian.

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)  
VIDEO #4 coming soon!  
[http://sensei.zenunit.com/](http://sensei.zenunit.com/)

---

<div class="post-metadata">

**Author:** ![Schalk\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@Schalk\_N](https://www.ruby-forum.com/u/Schalk_N)\
**Post date:** [April 14, 2008, 11:16am UTC](https://www.ruby-forum.com/t/rails-and-dojo/134677/7 "2008-04-14T11:16:59Z")

</div>

Hi there,

In the end it was so simple I could kick myself:  
\<%= f.text\_area :content, {dojoType = "dijit.Editor} %\>

And Bob’s your uncle 🙂

Regards,  
Schalk

---

<div class="post-metadata">

**Author:** ![Schalk\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b782af/32.png) [@Schalk\_N](https://www.ruby-forum.com/u/Schalk_N)\
**Post date:** [April 14, 2008, 2:08am UTC](https://www.ruby-forum.com/t/rails-and-dojo/134677/8 "2008-04-14T02:08:23Z")

</div>

\<%= f.text\_area(:content, {:dooType =\> “someDojoType”}) %\>

and

\<%= f.text\_area(:content, :dooType =\> “someDojoType”) %\>

are the same thing. If the last argument is a hash, there is no need to  
include the hash tags. Matter of personal preference, but I prefer it  
without the explicit hash tags when they are not needed.

Julian L. wrote:

> Ummmm I think he wanted the dooType attribute set on the text area  
> tax, not sent in through the params attribute (ie on the key-val  
> mappings of the URL line).
> 
> that would be
> 
> \<%= f.text\_area(:content, {:dooType =\> “someDojoType”}) %\>
> 
> Here “content” would be the attribute of the object passed into the  
> form object “f”.
> 
> Is this what you wanted?
> 
> Julian.
> 
> Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)  
> VIDEO #4 coming soon!  
> [http://sensei.zenunit.com/](http://sensei.zenunit.com/)
