Hello I have (in add_article.rhtml) a select field with some option that shows a partial in according to the selected value (though observe_fied)
Code Ruby:<%= select_tag :article_type, options_for_select(Article::ARTICLE_TYPES) %> <%= observe_field :article_type, :update => :articleForm, :url => { :action => :show_article_form }, :with => "article_type" %> <% end %>
and it works fine. The problem is that in the partials I need some instance variable to populate some other select, for instance:
Code Ruby:<%= form.select :unit_id, @unit_list %>
but even if I have in my controller
Code Ruby:def add_article @unit_list = Unit.find(:all, :conditions => "scope = 1", :order =>"name").map { |u| [u.name, u.id] } end
I have a nill error
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.inject
related to the select above.
If I put directly the partial on add_article.rhtml it works do I guess the issue is related to the ajax call.
In which way can I use @unit_list in a partial that is called though ajax ???
THANKS




Bookmarks