[Rails] Re: redirect_to with a hash instead of parameters
Hai:
# create virtual models
# year_entry.rb
attr_accessor :year,
:month,
:day
# controller:
@year_entry_access = []
year_var = YearEntry.new
year_var.year = 2012
year_var.month = 1
year_var.day = 20
@year_entry_access << year_var
redirect_to :action=>show_rrr,:year_entry_access =>@year_entry_access
# After that you can pass other method
def show_rrr
if params[:year_entry_access] # here you can get params_hash format
params[:year_entry_access].each_value do |get_date|
get_date[:date]
get_month[:month]
get_year[:year]
end
end
end
# you can access like this way "get_date[:date]"
Bye:)
bdeveloper
--
Posted via http://www.ruby-forum.com/.
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home