On 11/04/2010 04:08 PM, Sergio Cambra .:: entreCables S.L. ::. wrote:
 On Jueves, 4 de Noviembre de 2010 14:06:44 Dan Candea escribió:
> On 11/04/2010 02:42 PM, Sergio Cambra .:: entreCables S.L. ::.
> wrote:
>> On Jueves, 4 de Noviembre de 2010 13:27:15 Dan Candea escribió:
>>> On 11/04/2010 01:07 PM, Sergio Cambra .:: entreCables S.L. ::.
>>> wrote:
>>>> On Jueves, 4 de Noviembre de 2010 11:42:26 Dan Candea
>>>> escribió:
>>>>> On 04.11.2010 12:13, Sergio Cambra .:: entreCables S.L. ::.
>>>>> wrote:
>>>>>> On Jueves, 4 de Noviembre de 2010 11:05:15 Dan Candea
>>>>>> escribió:
>>>>>>> On 11/04/2010 11:55 AM, Sergio Cambra .:: entreCables
>>>>>>> S.L. ::. wrote:
>>>>>>>> This method return nil if record.name is nil and
>>>>>>>> return the value returned by
>>>>>>>>
>>>>>>>> logger.info (i don't know what returns). Change it
>>>>>>>> with this: def value_form_column(record, input_name)
>>>>>>>>
>>>>>>>> column = active_scaffold_config.columns[:value] id =
>>>>>>>> active_scaffold_input_options(column)[:id]
>>>>>>>> logger.info
>>>>>>>> "##############################################
>>>>>>>> #{id}" select_options = record.name ?
>>>>>>>> User::LIST[record.name]
>>>>>>>>
>>>>>>>> : [] select :record, :value, select_options, :name
>>>>>>>> =>
>>>>>>>>
>>>>>>>> input_name, :id =>     id
>>>>>>>>
>>>>>>>> end
>>>>>>>
>>>>>>> with logger.info I was just trying to see the values
>>>>>>> for different variables so I can understand  were is
>>>>>>> the problem. now it crashes and I receive
>>>>>>>
>>>>>>>
>>>>>>> ActionView::TemplateError (undefined method `name' for
>>>>>>> nil:NilClass) on line #7 of
>>>>>>>
vendor/plugins/active_scaffold/frontends/default/views/_form_attribu
>>>>>>>
>>>>>>>
te .h tml .erb: 4:<label for="<%=
>>>>>>> active_scaffold_input_options(column, scope)[:id]
>>>>>>> %>"><%= column.label %></label> 5:</dt> 6:<dd> 7:<%=
>>>>>>> active_scaffold_input_for column, scope %> 8:<% if
>>>>>>> column.options.is_a?(Hash)&&
>>>>>>> column.options[:update_column] -%>  9:<%=
>>>>>>> loading_indicator_tag(:action =>    :render_field, :id
>>>>>>> => params[:id]) %> 10:<% end -%>
>>>>>>
>>>>>> Backtrace isn't useful without removing backtrace
>>>>>> silencers (uncomment last line in
>>>>>> config/initializers/backtrace_silencers.rb)
>>>>>
>>>>> I attached a file with the backtrace
>>>>>
>>>>> thank you
>>>>
>>>> The exception is due to value column doesn't exist, there is
>>>> no value column in active_scaffold_config.columns.
>>>>
>>>> Is the column named value? Becuase helper is named
>>>> valorae_form_column
>>>
>>> the actual field is valoare, value is just the example I put in
>>> the emails, cause the code is more complex that this.
>>>
>>>> Are you accessing to UserController directly? Becuase helper
>>>> override is on another helper. If you are using a subform you
>>>> will have to use active_scaffold_config_for(User) and pass a
>>>> scope to active_scaffold_input_options.
>>>
>>> yes, it is in a subform. I've put active_scaffold_config_for
>>> and now I get again  the RSJ the id is trying to update is
>>> $("record_value__users_1288873379924").up is this correct?
>>>
>>> look how it is created in the browser: <select
>>> id="record_value" name="record[value]" class=""></select>
>>
>> Sorry, select tag has another options hash before html options
>> hash, try with this: select :record, :valorae, select_options,
>> {}, :name =>  input_name, :id =>  id
>>
>> Probably you will need to pass '[users]' (the scope) to
>> active_scaffold_input_options in order to get right id, you will
>> have to use a fixed scope because I think you can't get current
>> scope.
>
> so I should have id =
> active_scaffold_input_options(column,'[users]')[:id] ?
>
> I checked and id is
> record_value_07a967bd048be601d049f5b264bf6815_users
>
> and AS is trying to replace
> $("record_value_07a967bd048be601d049f5b264bf6815").up("dl").replace
>
>
>
is this right?

 Then remove '[users]', I thought it would be needed

I figured out why some of your solutions didn't worked. I had two ActiveRecord models with same attributes name, which is ok in a rails applications, but not for AS.
so without subform is working, the code is below

def value_form_column(record, input_name)
        column = active_scaffold_config_for(User).columns[:value]
        id = active_scaffold_input_options(column)[:id]
        select_options = record.name ? User::LIST[record.name] : [id]
select :record, :value, select_options, {} , :name => input_name, :id => id
  end

now, as a subform I get the id with

id = active_scaffold_input_options(column,'[users]')[:id]

and I get /record_value__users/
but AS tries to update /$("record_value__users_1288884415612").up/ which I think is the right one.

how do I get the good scope? or how could I test if there is subform or not?


thank you for your patience


>
>>> id field does not match, no class
>>>
>>>> It's easier to get it working in UserController, without
>>>> subform, and then modify it to work in a subform.
>>>
>>> without subform I don't get RJS error, but nothing happens, the
>>> select is not updated again as above, the id field is like
>>> above



--
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