Hi all,
Once again I’m looking for all y’alls help. Currently I have a
link_to_remote as follows:
<%=link_to_remote(product.name, :update => “selected_product”, :url =>
{:action => “show”, :id => product.code})%>
This link updates a div called selected_product. On the page that is
rendered in the updated div, I use a Greybox plugin to show images, but
when the div is updated, the Greybox is disabled for some reason. I
found this site which seemed to fix my problem temporarily.
http://www.intridea.com/2007/11/21/link_to_remote-unobtrusively
It worked for some reason without having to re-do the link_to_remote
helper, but after restarting my Webrick I get this error now:
try { } catch (e) { alert(‘RJS error:\n\n’ + e.toString()); alert(‘’);
throw e }
Here is my controller code:
def show
@product = Product.find_by_code(params[:id])
if !@product
flash[:notice] = “Sorry, we couldn’t find the product you were
looking for”
redirect_to :action => ‘index’ and return false
end
@title = @product.name
@images = @product.images.find(:all)
@default_image = @images[0]
@variations = @product.variations.find(
:all,
:order => ‘name ASC’,
:conditions => ‘quantity > 0’
)
respond_to do |format|
format.html{redirect_to :back}
format.js{render :update do |page|
end }
end
end
The respond_to is a portion from the site above.
I tried the above link suggestion to edit the helper, but I get a error
stating
super: no superclass method `link_to_remote’
So my question is using a link_to_remote, how can javascript be enabled
in an updated div?