hi! all! my camping version is . 1.5.180 mongrel is 1.1.5 Finally, my web site is almost complete. thank you! camper!!!!! but, i has one little problem. i know that how connect ''some page'' and ''some controller''. In this case, how i can connect ''div '' and ''some controller'' Sample code has a few modifications. require ''camping''> > Camping.goes :Blog > > module Blog::Models > class Post < Base; belongs_to :user; end > class Comment < Base; belongs_to :user; end > class User < Base; end > end > > module Blog::Controllers > class Index < R ''/'' > def get > @posts = Post.find :all > render :index > end > end > class News #point 2 > def get > p ''this is News get'' > render :news > end > end > end > > module Blog::Views > def layout > html do > body do > div :id => ''news'' do # point 1 > self << news > end > > div :id => ''content'' do > self << yield > end > end > end > end > > def index > for post in @posts > h1 post.title > end > end > > def news #point 3 > ul do > li ''test1'' > li ''test2'' > li ''test3'' > li ''test4'' > end > end > > end >this code is can''t connect News controller.( not print ''this is News get'' ) i want connect point1 and point2 .... like a Index controller and change ul list(point3) Do not worry about if my article has typing miss -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20090506/6acd3855/attachment-0001.html>
Let me see if I understand your problem correctly:On every page you want to include news, which should go through the News-controller? Here''s one way to do it: http://pastie.textmate.org/private/0a47n2wegu7xdaovoudu2q //Magnus Holm On Wed, May 6, 2009 at 11:34, in-seok hwang <his2000x at gmail.com> wrote:> hi! all! > > my camping version is . 1.5.180 > mongrel is 1.1.5 > > Finally, my web site is almost complete. > thank you! camper!!!!! > > but, i has one little problem. > > i know that how connect ''some page'' and ''some controller''. > > In this case, how i can connect ''div '' and ''some controller'' > > Sample code has a few modifications. > > require ''camping'' >> >> Camping.goes :Blog >> >> module Blog::Models >> class Post < Base; belongs_to :user; end >> class Comment < Base; belongs_to :user; end >> class User < Base; end >> end >> >> module Blog::Controllers >> class Index < R ''/'' >> def get >> @posts = Post.find :all >> render :index >> end >> end >> class News #point 2 >> def get >> p ''this is News get'' >> render :news >> end >> end >> end >> >> module Blog::Views >> def layout >> html do >> body do >> div :id => ''news'' do # point 1 >> self << news >> end >> >> div :id => ''content'' do >> self << yield >> end >> end >> end >> end >> >> def index >> for post in @posts >> h1 post.title >> end >> end >> >> def news #point 3 >> ul do >> li ''test1'' >> li ''test2'' >> li ''test3'' >> li ''test4'' >> end >> end >> >> end >> > > this code is can''t connect News controller.( not print ''this is News get'' ) > > i want connect point1 and point2 .... like a Index controller > and change ul list(point3) > > Do not worry about if my article has typing miss > > > > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20090506/509a9a00/attachment.html>
thank you! Magnus Holm!!!! the problem has been resolved. finally , i can sleep :) have a nice day~ 2009/5/7 Magnus Holm <judofyr at gmail.com>:> Let me see if I understand your problem correctly: > On every page you want to include news, which should go through the > News-controller? > Here''s one way to do > it:?http://pastie.textmate.org/private/0a47n2wegu7xdaovoudu2q > > //Magnus Holm > > > On Wed, May 6, 2009 at 11:34, in-seok hwang <his2000x at gmail.com> wrote: >> >> hi! all! >> >> my camping version is . 1.5.180 >> mongrel is 1.1.5 >> >> Finally, my web site is almost complete. >> thank you! camper!!!!! >> >> but, i has one little problem. >> >> i know that how connect ''some page'' and ''some controller''. >> >> ?In this case, how i can connect ''div '' and ''some controller'' >> >> Sample code has a few modifications. >> >>> ???? require ''camping'' >>> >>> ????? Camping.goes :Blog >>> >>> ????? module Blog::Models >>> ??????? class Post < Base; belongs_to :user; end >>> ??????? class Comment < Base; belongs_to :user; end >>> ??????? class User < Base; end >>> ????? end >>> >>> ????? module Blog::Controllers >>> ??????? class Index < R ''/'' >>> ????????? def get >>> ??????????? @posts = Post.find :all >>> ??????????? render :index >>> ????????? end >>> ??????? end >>> ??????? class News?????????????? #point 2 >>> ????????? def get >>> ??????????? p ''this is News get'' >>> ??????????? render :news >>> ????????? end >>> ??????? end >>> ????? end >>> >>> ????? module Blog::Views >>> ??????? def layout >>> ????????? html do >>> ??????????? body do >>> ????????????? div :id => ''news'' do??????? # point 1 >>> ???????????????? self << news >>> ????????????? end >>> >>> ????????????? div :id => ''content'' do >>> ???????????????? self << yield >>> ????????????? end >>> ??????????? end >>> ????????? end >>> ??????? end >>> >>> ??????? def index >>> ????????? for post in @posts >>> ??????????? h1 post.title >>> ????????? end >>> ??????? end >>> >>> ??????? def news?????????????? #point 3 >>> ????????? ul do >>> ???????????????????? li ''test1'' >>> ???????????????????? li ''test2'' >>> ???????????????????? li ''test3'' >>> ???????????????????? li ''test4'' >>> ?????????? end >>> ???????? end >>> >>> ????? end >> >> this code is can''t connect News controller.( not print ''this is News get'' >> ) >> >> i want? connect point1 and point2 .... like a Index controller >> and change ul list(point3) >> >> Do not worry about if my article has typing miss >> >> >> >> >> >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >