Search Results

Search found 2 results on 1 pages for 'nicosuria'.

Page 1/1 | 1 

  • What's a good plugin or guide I can use to create javascript widgets from a Rails App?

    - by nicosuria
    I've been looking around for a while now and the best guide I've seen so far is Dr Nic's DIY widgets how to (here). I haven't been able to make something like this work: Assuming this is my widget code: <script src="http://mysite/nomnoms.js"> </script> And my nomnoms controller looks like (assume that the list partial exists and simply lists down a link to the show page of each nomnom in the @nomnoms variable): class NomnomsController < ApplicationController def index @nomnoms = Nomnom.find(:all) @content = render_to_string(:partial => 'list') end end And in the index.js of my nomnoms_controller I have: page << "document.write('<div>'" page << "document.write('#{@content.to_json}')" page << "</div>" The above setup doesn't render anything :(. But when I change the second line of index.js to: page << "document.write('nomnoms should be here') ...the widget renders the text. Any help or even a point in the right direction would be greatly appreciated. Thanks in advance.

    Read the article

  • Dynamically defined setter methods using define_method?

    - by nicosuria
    I use a lot of iterations to define convenience methods in my models, stuff like: PET_NAMES.each do |pn| define_method(pn) do ... ... end but I've never been able to dynamically define setter methods, ie: def pet_name=(name) ... end using define_method like so: define_method("pet_name=(name)") do ... end Any ideas? Thanks in advance.

    Read the article

1