Jquery + Rails

Can someone tell me any tutorial wich I could follow in order to learn Jquery with Rails?. I see many tutorias about Jquery but I don`t know how to render it in rails views.

I’m trying to do this but it does not work.

<%= image_tag current_user.avatar_file_name , :class => ‘user-img_style’, :id => ‘jquery’%>

That should work. I quickly tested it using a different image, obviously, but otherwise the same code. it worked for me. when it’s not working for you, what exactly happens? do you get any error messages in the log? does the image appear as it’s supposed to?

Hi good morning, now it works.

Could you please tell me how can I open a modal window with a form in order to do an AJAX request with Jquery?.

What I need is, when the user click on the image a modal window appear with the option to change the current profile image. I’m trying to use $.get(‘users/_form.html.erb) but this is never showed.

Thanks and regards.

Alfredo.

jQuery is very much integrated with Rails. Try looking at Micheal Hartl's tutorial and completely work through it. You need the basics of the framework, coffeesript, and how it comes together. In general, you should not be using <script> in your views.

Ok I’m working with Jquery, I really like it , it looks easy and powerful. I have an issue here. I’m trying to change one CSS property from Jquery. This ‘add-photo-mw’ has pre-defined ‘display:none’. Below is the code. <%= link_to ‘Add photo’, adding_photo_path(current_user), class:‘css3button’, :id => ‘add-photo-mw’%> When this link is tiggered <%= link_to ‘Go to Gallery’, loading_gallery_path, class:‘css3button’, :id => ‘show-add’ %> the following Jquery code is launched. $(document).ready(function(){ $(‘#show-add’).click(function(){ $(‘#add-photo-mw’).css(‘display’,‘inline’); }); } );

Everything looks good, when the link is selected the link_tag is showed in the browser, but secods later the link is hide again. You know why is this happening?.

Thanks & regards.

Alfredo.