I have a controller a_bs_controller that usually has to find A by
a_id:.  So, among others,  it has these methods:

def update
  this_a
  .  .  .
end
.  .  .

def this_a
  @a = A.find(params[:a_id])
end

My difficulty arises in that sometimes this controller is passed :a_id
in a nested hash as [:a]{:id], with or without :a_id in another
portion of a nested hash. .

params => { :controller => :a_bs, .  .  . ,  :a => { :id => 'x'}, :c
=> 'value', :b => { a_id => 'x', :description => 'value' }}

What I would really like to do is to discover some method of setting
params[:a_id] in the views that return it as a nested hash otherwise.
Failing that I need to extract the :id of :a from whatever params I am
handed.  I should never receive :a_id simply as :id in a simple hash
as is the usual case for as_controller.

I tried to solve this in the view by modifying the params hash both
directly and through a hidden field. In both cases the result was
nested inside of a hash named :b.  I have also played with
constructing a method to walk down the hashes to find :a_id, however,
I have put that aside for now to see if my problem is really my
approach to the solution.
-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to