RailsCasts Pro episodes are now free!

Learn more or hide this

Bharath D patil's Profile

GitHub User: bharathpatil15

Comments by Bharath D patil


Hey Guys i am a newbie to this...Based on this railcast i tried to do the following. Failed. Can anyone please help?

This is my View

`<%= f.association :product, :collection => Product.in_stock %>

<%= f.grouped_collection_select :batch_no, Product.in_stock, :store_opening_stocks, :title, :batch_no, :batch_no, :prompt => "Select Batch"%>`

This is Jquery.

var child = jQuery('.batch').html();
jQuery('.prod').change(function() {
var parent = jQuery('.prod :selected').text();
var escaped_parent = parent.replace(/([ #;&,.+*~\':"!^$[]()=>|\/@])/g, '\$1')

var options = jQuery(child).filter("optgroup[label='#{escaped_parent}']").html()
if (options) {
return jQuery('.batch').parent().show();
} else {

Really need help been stuck for a week now. Any Help would be helpful.


Hey Ryan, yet another amazing rail-cast. I have learned loads abt ruby and rails just following the videos here. Currently using nested_form gem works wonderfully, but prototype seems to have a conflict with jQuery, any help regarding that would be helpful. Thank you.