On 11/04/2010 11:55 AM, Sergio Cambra .:: entreCables S.L. ::. wrote:
On Jueves, 4 de Noviembre de 2010 10:28:21 Dan Candea escribió:
On 11/04/2010 11:11 AM, Sergio Cambra .:: entreCables S.L. ::. wrote:
On Jueves, 4 de Noviembre de 2010 09:57:41 Dan Candea escribió:
On 11/04/2010 10:50 AM, Sergio Cambra .:: entreCables S.L. ::. wrote:
On Miércoles, 3 de Noviembre de 2010 18:05:21 Dan Candea escribió:
On 11/03/2010 06:54 PM, Sergio Cambra .:: entreCables S.L. ::. wrote:
On Miércoles, 3 de Noviembre de 2010 17:44:58 Dan Candea escribió:
so I should i do it ?

def value_form_column(record, input_name)
column = active_scaffold_config.columns[:value]
id = active_scaffold_input_options(column)[:id]
select :record, :value, options_for_select(User::LIST[record.name]),

:name =>      input_name, :id =>       id

I'm updating the content of a select which doesn't exists, the id I
get above it doesn't exists
Please, can you explain your case in detail. What controller are you
accessing? UsersController?  Or another controller with user in a
subform? Post your user controller too. Is value a db attribute?
it's another controller with user in a sub form, but same this is
happening when I access directly the UserControler;

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

      end

end
Controllers in rails usually use plural form, UsersController instead
of UserController, although it should work anyway.

value is a db attribute. name also
and I'm using rails-2.3 branch

when I chose Create, a new form is created, as expected, with the
config columns as above.
I looked in the generated html and there is no<select.....>
</select>  element for the /value/ db attribute.
So the new select element which I update in value_form_column()
function with the specified id it doesn't exists.
You have to define value_form_column method in UserHelper to be used
when you go to UserController directly. Do you get value label at
least?
yes. the label is there with a field for="record_value_32...."

the value_form_column is defined and the id I get, with the methods you
told me, is the same with the one from the label
Post your helper again, must be something wrong there.
module UsersHelper
    def value_form_column(record, input_name)
      if record.name
      column = active_scaffold_config.columns[:value]
      id = active_scaffold_input_options(column)[:id]
      select :record, :value, options_for_select( ["sas","Sasdd"]), :name
=>  input_name, :id =>  id
       logger.info "############################################## #{id}"
      end
    end
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_attribute.html.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 -%>



    def aregno_form_column(record, input_name)
      text_field :record, :aregno, :value =>  (User.maximum('aregno') ||
0) + 1
    end
end

thank you for your patience


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