Need some help please!!! I have a hash that contain a group of post, i render this hash on html. I want that with a checkbox the person can select the post to save it on the database. Somebody know how to do this, i dont understant the check_box_tag. -- Felipe Vergara Contesse Ingeniería Civil Industrial UC --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
On 22 Aug 2008, at 22:54, Felipe Vergara wrote:> Need some help please!!! > > I have a hash that contain a group of post, i render this hash on > html. I want that with a checkbox the person can select the post to > save it on the database. > > Somebody know how to do this, i dont understant the check_box_tag.check_box_tag isn''t particularly magic. It does just create a checkbox with the specified name. What''s in your hash (what are the keys/values) Fred> > > > -- > Felipe Vergara Contesse > Ingeniería Civil Industrial UC > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
The hash contains an array with post objects, id, title, body> >-- Felipe Vergara Contesse Ingeniería Civil Industrial UC --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
html.erb <%form_for(:person do |f|)%> <%= check_box(:person,:permanent_employee,:options=>{},:on_value => "1",:off_value => "0")%> <%end> controller edit_method ---- @person=Person.find_by_id(params[:id]) @person.update_attributes(params[::person]) @person.permanent = params[:person][:permanent_employee] @person.save I believe. it is work -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
html.erb <%form_for(:person do |f|)%> <%= check_box(:person,:permanent_employee,:options=>{},:on_value => "1",:off_value => "0")%> <%end> controller edit_method ---- @person=Person.find_by_id(params[:id]) @person.update_attributes(params[::person]) @person.permanent = params[:person][:permanent_employee] @person.save I believe. it is work -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
a small correction in your form <%form_for(:person) do |f|%> On Tue, May 17, 2011 at 11:12 AM, bala TS <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> html.erb > > <%form_for(:person do |f|)%> > <%= check_box(:person,:permanent_employee,:options=>{},:on_value => > "1",:off_value => "0")%> > <%end> > > controller > edit_method > ---- > @person=Person.find_by_id(params[:id]) > @person.update_attributes(params[::person]) > @person.permanent = params[:person][:permanent_employee] > @person.save > > I believe. it is work > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- ~N a r e n -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.