I will have a number of teachers each assigned a number of spots on a
schedule.
The teachers name will be displayed each cell they are assigned and I
want the background display of each teacher to be a different color
which I will retrieve in the view and insert into an inline style.
I decided to make the background color an attribute of a teacher_day
model. I''ll assign colors shortly after I''ve created a
collection of
teacher_days for a schedule.
here is a method I tried that doesn''t work
def assign_colors
for teacher in @schedule.teacher_days
teacher.update_attributes( :bgcolor => cycle("red",
"green", "blue")
)
end
end
The cycle doesn''t seem to work within the update attributes..saying
that
it isnt a method for <object>.
I would like to easily be able to expand or contract the number of items
in the color array. (I probably should keep it as a constant someplace
else too?).
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---