On 11/03/2010 10:20 AM, Sergio Cambra .:: entreCables S.L. ::. wrote:
On Martes, 2 de Noviembre de 2010 14:54:45 Dan escribió:
hello

I would appreciate some help with the issue below.

I have in a model a hash with array values, like this

class User<  ActiveRecord::Base

   LIST = { "Dan" =>  ["333","abc"] ,
            "John" =>  ["777","qwery"] ,
         }
end

class UserController<  ApplicationController
   active_scaffold :user do |config|
     config.label = "Test"
     config.columns = [:name, :value]
     config.columns[:name].form_ui = :select
     config.columns[:name].options = {:options =>  User::LIST.map}
     config.columns[:name].update_column = :value
     config.columns[:value].form_ui = :select
   end
end

I what that on selection of a name from the User::LIST on :value field
to be presented with the options from the array
how can I do that?
You can't use :select form_ui in this case, you will have to make a form
override for value column

so I added

module UserHelper
  def value_form_column(record, input_name)
  if record.name
    select_tag input_name, options_for_select(record.name)
  else
    select_tag input_name, options_for_select([])
  end
  end
end

is this correct ?
sorry for bottoring with this but the documentation is so light

when .update_column  is exexcuted i get

RJS error:
TypeError: Cannot call method 'up' of null

  I searched all the docs but only possible solution is to use Custom
Association Options, but this means the values should be stored in the
database

thank you


--
Dan Cândea
Does God Play Dice?

--
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to