Hi, I created a calendar class and i now have a method which gives me a 1 day view with timeslots etc. now i want to re-use that code for generating 2 and 5 day views. how can i re-use my code so i can make a show_two_days class which uses the logic of the show_one_day class? am i correct it can''t be done with helpers? regards, Remco -- Posted via http://www.ruby-forum.com/.
Remco Hh wrote:> Hi, > I created a calendar class and i now have a method which gives me a 1 > day view with timeslots etc. now i want to re-use that code for > generating 2 and 5 day views. how can i re-use my code so i can make a > show_two_days class which uses the logic of the show_one_day class? > > am i correct it can''t be done with helpers? > > regards, > > RemcoI dunno if I understand you but you might have a look to render_component -- Posted via http://www.ruby-forum.com/.
If they''re in the same controller, one method can call another. If not, put the shared method in application.rb and it becomes available from every controller. - dan -- Dan Kohn <mailto:dan@dankohn.com> <http://www.dankohn.com/> <tel:+1-415-233-1000> On Jul 24, 2006, at 12:59 PM, Remco Hh wrote:> Hi, > I created a calendar class and i now have a method which gives me a 1 > day view with timeslots etc. now i want to re-use that code for > generating 2 and 5 day views. how can i re-use my code so i can make a > show_two_days class which uses the logic of the show_one_day class? > > am i correct it can''t be done with helpers? > > regards, > > Remco > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails