In place editor with drop downs

Trying to figure out how to do this and came across this page:

Seems a little confusing as to what is what in the method definitions.
Anyone use it or have another way to get drop downs into the in place

Confusing regarding above link:
1- In applicationhelper

def in_place_collection_editor_field(object,method,container) # I take
the container is the paramters for the collection Somemodel.find(:all.

# object,
method didn’t take as symbols or ‘string’.

The final parameter, container, contains the options for the drop-down
box. First, resolve a tag and create the submit URL:

tag =, method, self) #
not sure what self is referring to here.
url = url_for( :action => “set_#{object}_#{method}”, :id => ) #okay , this makes sense.

Then we move on to the controller code:

On the controller side, you will need to define a method
set_object_methodto handle the input. Next, start the definition of
the function: # am i
actually naming it set_object_method or just set_myobject_mymethod ?
function = “new Ajax.InPlaceCollectionEditor(” function <<
function << “’#{url}’,”

Then, process the options:
collection = container.inject([]) do |options, element| options << “[

Finally, add the collection to the final Javascript:
function << “{collection: [#{collection.join(’,’)}],” function << “});”


RailsRecipes has a recipe for this , so I’m working through that now :slight_smile:


On 11/1/06, Dark A. [email protected] wrote: ) #okay , this makes sense.
Then, process the options:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs