I have an issue whereby, say I have a button in a view......that shows one way if a boolean field in a db is true, and another way when it is false. When the value of that field in the db changes, I want the button;s state in the view to change as well. How would you guys recommend I do this? Thanks, R.Vince -- 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.
Use a helper method to represent this condition. On Sat, Dec 12, 2009 at 6:38 PM, RVince <rvince99-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> I have an issue whereby, say I have a button in a view......that shows > one way if a boolean field in a db is true, and another way when it is > false. > When the value of that field in the db changes, I want the button;s > state in the view to change as well. > How would you guys recommend I do this? Thanks, R.Vince > > -- > > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > >-- Andrei Erdoss -- 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.
2009/12/12 RVince <rvince99-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>:> I have an issue whereby, say I have a button in a view......that shows > one way if a boolean field in a db is true, and another way when it is > false. > When the value of that field in the db changes, I want the button;s > state in the view to change as well. > How would you guys recommend I do this? Thanks, R.VinceJust pass the state of the boolean up to the view ( @state = whatever in the controller ) then test this in the view and change the appearance as necessary. Probably setting the button class and using css. Colin -- 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.