On Tue, Oct 25, 2011 at 4:14 AM, Sebastian
<[email protected]>wrote:

> Ah, I found my mistake!!!
>
> I was just only adding JQuery in my view with <%=
> javascript_include_tag "http://code.jquery.com/jquery-latest.js"; %>,
> but not in my application.html.erb. That means that the code in the
> application.js had propably no JQuery access!
>
>
Ok remove this

javascript_include_tag "http://code.jquery.com/jquery-latest.js"; %>,

google to your Gemfile and at this

gem "jquery-rails"

then in the console

bundle install

this will install jquery the right way

then go to `config/application.rb` and verify that :defaults is made up of
this


    config.action_view.javascript_expansions[:defaults] = %w(rails jquery)

this like here is what tells rails what to output in the
`javascript_include_tag
:defaults` line

now jquery is set up.


> My problem now is that my other normal Rails Java Helpers (see
> below )are not working anymore as intended!
>
> <%= button_to 'Destroy', product, :confirm => 'Are you sure?', :method
> => :delete %>
> That one is wotking, but there is no confirm pop up!!!!
>

Is possible that you are have installed prototype which has similar syntax
to that of jquery.

I notice you said 'Java' helpers,  pay attention, javascript is not java,
they have similar syntax but that's it.

Now what version of rails are you using, this helper changed their out put
in rails 3.x+ from that found in rails 2.x-.



> I read something about JRails. Is that an option or is there another
> way???
>

JRuby is not a javascript+ruby package is java with a ruby sintax, is a
replacement for the ruby interpreter that lets Ruby run on the java virtual
machine. Some gems are not compatible with jruby.

Remember, java and javascript are unrelated, the name javascript was give to
javascript because java was popular back when javascript was been develop.
 Java is a general purpose programing language, javascript is a scripting
language aimed mainly at the web.

read this also:

http://en.wikipedia.org/wiki/JavaScript


The deal with javascript and 'the other way' is that , since javascript was
develop when the web  was very young it has lots of short coming, so people
start creating functions to deal with those short coming and eventually put
them together to made a library, for example, to capture a the form with an
id for filter without using any javascript library you would have to type
this


document.getElementById('filters')

as you can see that is a bit long, also if it were a class you would have to
do this

document.getElementByClassName('show1')

and if you have to capture a tag type

document.getElementByTagName('input')

so many libraries have a function that replaces this with $( ) where $ is
the name of the function. In jquery you distinguish what is that you want to
capture by addin a #, a . or nothing.

the result is :

document.getElementById('filters')

is

$("#filters")

document.getElementByClassName('show1')

is

$(".show1")

and

document.getElementByTagName('input')

is

$('input')


Javascript right now is the only client side programming language (that i
know of, also google is making a new more modern one called
Dart<http://en.wikipedia.org/wiki/Dart_(programming_language)> that
is suppose to fix all the short coming of javascript  and you can try it
here <http://try.dartlang.org/>) but there are many libraries (the other way
around you asked about maybe?)

   - DOJO <http://dojotoolkit.org/>
   - Yahoo <http://developer.yahoo.com/yui/>
   - Prototype <http://www.prototypejs.org/>
   - Jquery <http://jquery.com/>
   - MochiKit <http://mochikit.com/>
   - Ext JS <http://extjs.com/>
   - Open Rico <http://openrico.org/>
   - Qooxdoo <http://qooxdoo.org/>
   - Moo Tools <http://mootools.net/>
   - X library <http://cross-browser.com/>
   - Fork <http://forkjavascript.org/>
   - OAT <http://oat.openlinksw.com/>
   - AJS <http://orangoo.com/labs/AJS/>

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to