• #8 楼 @michael 自己改的 monokai

  • 不缺想法就缺能做的人

  • 快捷迅速的编辑器 at 2012年07月03日

    vim +1

  • 买个超级本装 linux 吧,很爽的

  • #3 楼 @wang0109 看了这个插件,没有 XPTemplate 强大,而且必须编译 python 支持

  • #1 楼 @allenwei 还有没有什么强大的功能,我加上去

  • Sublime Text 2.0 稳定版发布 at 2012年06月29日

    #9 楼 @ery 可以慢慢学嘛, 话说我还从来没有为软件花过钱,想什么时候体验一下 不过 59 美元=374.8412 人民币元,对我来说还是比较贵

  • Sublime Text 2.0 稳定版发布 at 2012年06月29日

    吼吼,支持大家买正版,用的安心一点,人家做这么优秀的软件不容易,大家也是程序员 BTW,我还是对开源的开发工具比较放心,比如 vim

  • #2 楼 @eddie 嗯,看看

  • 预览

  • @categ.each_with_index do |e,i|
      if i != 0
        @videos << Video.includes(:videodatum).where(:cid => e).order('lastdate DESC').limit(5)
        # @tops << Video.joins('LEFT OUTER JOIN videodata ON videodata.video_id = videos.id').where(:cid => e).order('hits DESC').limit(10)
        @tops << Video.includes(:videodatum).where(:cid => e).order('videodata.hits DESC').limit(10)
    
      end
    end
    
  • #10 楼 @Rei 嗯,现在好了

    Started GET "/" for 127.0.0.1 at 2012-06-26 20:32:19 +0800
    Processing by VideosController#index as HTML
      Categorgy Load (2.1ms)  SELECT `categorgies`.* FROM `categorgies` ORDER BY cup
      Rendered videos/_toolbar.html.erb (0.1ms)
      Video Load (5.8ms)  SELECT `videos`.* FROM `videos` WHERE `videos`.`cid` IN (5, 6, 7, 8, 9, 10, 11) ORDER BY lastdate DESC LIMIT 5
      Videodatum Load (1.6ms)  SELECT `videodata`.* FROM `videodata` WHERE `videodata`.`video_id` IN (1041, 1039, 1036, 1000, 1037)
      Video Load (4.8ms)  SELECT `videos`.* FROM `videos` WHERE `videos`.`cid` IN (13, 15, 16, 17, 37) ORDER BY lastdate DESC LIMIT 5
      Videodatum Load (1.8ms)  SELECT `videodata`.* FROM `videodata` WHERE `videodata`.`video_id` IN (1033, 941, 943, 942, 929)
      Video Load (6.7ms)  SELECT `videos`.* FROM `videos` WHERE `videos`.`cid` IN (32, 20, 30) ORDER BY lastdate DESC LIMIT 5
      Videodatum Load (1.5ms)  SELECT `videodata`.* FROM `videodata` WHERE `videodata`.`video_id` IN (776, 672, 947, 930, 866)
      Video Load (3.7ms)  SELECT `videos`.* FROM `videos` WHERE `videos`.`cid` IN (29, 33, 34) ORDER BY lastdate DESC LIMIT 5
      Videodatum Load (1.5ms)  SELECT `videodata`.* FROM `videodata` WHERE `videodata`.`video_id` IN (1040, 491, 925, 924, 923)
      SQL (34.0ms)  SELECT `videos`.`id` AS t0_r0, `videos`.`cid` AS t0_r1, `videos`.`nid` AS t0_r2, `videos`.`author` AS t0_r3, `videos`.`authorid` AS t0_r4, `videos`.`postdate` AS t0_r5, `videos`.`lastdate` AS t0_r6, `videos`.`name` AS t0_r7, `videos`.`picfolder` AS t0_r8, `videos`.`pic` AS t0_r9, `videos`.`playactor` AS t0_r10, `videos`.`director` AS t0_r11, `videos`.`tag` AS t0_r12, `videos`.`year` AS t0_r13, `videos`.`description` AS t0_r14, `videos`.`best` AS t0_r15, `videos`.`serialise` AS t0_r16, `videos`.`memo` AS t0_r17, `videos`.`yz` AS t0_r18, `videodata`.`video_id` AS t1_r0, `videodata`.`hits` AS t1_r1, `videodata`.`reply` AS t1_r2, `videodata`.`sale` AS t1_r3, `videodata`.`need` AS t1_r4, `videodata`.`usernth` AS t1_r5, `videodata`.`fraction` AS t1_r6, `videodata`.`star` AS t1_r7 FROM `videos` LEFT OUTER JOIN `videodata` ON `videodata`.`video_id` = `videos`.`id` WHERE `videos`.`cid` IN (5, 6, 7, 8, 9, 10, 11) ORDER BY videodata.hits DESC LIMIT 10
      SQL (11.6ms)  SELECT `videos`.`id` AS t0_r0, `videos`.`cid` AS t0_r1, `videos`.`nid` AS t0_r2, `videos`.`author` AS t0_r3, `videos`.`authorid` AS t0_r4, `videos`.`postdate` AS t0_r5, `videos`.`lastdate` AS t0_r6, `videos`.`name` AS t0_r7, `videos`.`picfolder` AS t0_r8, `videos`.`pic` AS t0_r9, `videos`.`playactor` AS t0_r10, `videos`.`director` AS t0_r11, `videos`.`tag` AS t0_r12, `videos`.`year` AS t0_r13, `videos`.`description` AS t0_r14, `videos`.`best` AS t0_r15, `videos`.`serialise` AS t0_r16, `videos`.`memo` AS t0_r17, `videos`.`yz` AS t0_r18, `videodata`.`video_id` AS t1_r0, `videodata`.`hits` AS t1_r1, `videodata`.`reply` AS t1_r2, `videodata`.`sale` AS t1_r3, `videodata`.`need` AS t1_r4, `videodata`.`usernth` AS t1_r5, `videodata`.`fraction` AS t1_r6, `videodata`.`star` AS t1_r7 FROM `videos` LEFT OUTER JOIN `videodata` ON `videodata`.`video_id` = `videos`.`id` WHERE `videos`.`cid` IN (13, 15, 16, 17, 37) ORDER BY videodata.hits DESC LIMIT 10
      SQL (16.7ms)  SELECT `videos`.`id` AS t0_r0, `videos`.`cid` AS t0_r1, `videos`.`nid` AS t0_r2, `videos`.`author` AS t0_r3, `videos`.`authorid` AS t0_r4, `videos`.`postdate` AS t0_r5, `videos`.`lastdate` AS t0_r6, `videos`.`name` AS t0_r7, `videos`.`picfolder` AS t0_r8, `videos`.`pic` AS t0_r9, `videos`.`playactor` AS t0_r10, `videos`.`director` AS t0_r11, `videos`.`tag` AS t0_r12, `videos`.`year` AS t0_r13, `videos`.`description` AS t0_r14, `videos`.`best` AS t0_r15, `videos`.`serialise` AS t0_r16, `videos`.`memo` AS t0_r17, `videos`.`yz` AS t0_r18, `videodata`.`video_id` AS t1_r0, `videodata`.`hits` AS t1_r1, `videodata`.`reply` AS t1_r2, `videodata`.`sale` AS t1_r3, `videodata`.`need` AS t1_r4, `videodata`.`usernth` AS t1_r5, `videodata`.`fraction` AS t1_r6, `videodata`.`star` AS t1_r7 FROM `videos` LEFT OUTER JOIN `videodata` ON `videodata`.`video_id` = `videos`.`id` WHERE `videos`.`cid` IN (32, 20, 30) ORDER BY videodata.hits DESC LIMIT 10
      SQL (15.6ms)  SELECT `videos`.`id` AS t0_r0, `videos`.`cid` AS t0_r1, `videos`.`nid` AS t0_r2, `videos`.`author` AS t0_r3, `videos`.`authorid` AS t0_r4, `videos`.`postdate` AS t0_r5, `videos`.`lastdate` AS t0_r6, `videos`.`name` AS t0_r7, `videos`.`picfolder` AS t0_r8, `videos`.`pic` AS t0_r9, `videos`.`playactor` AS t0_r10, `videos`.`director` AS t0_r11, `videos`.`tag` AS t0_r12, `videos`.`year` AS t0_r13, `videos`.`description` AS t0_r14, `videos`.`best` AS t0_r15, `videos`.`serialise` AS t0_r16, `videos`.`memo` AS t0_r17, `videos`.`yz` AS t0_r18, `videodata`.`video_id` AS t1_r0, `videodata`.`hits` AS t1_r1, `videodata`.`reply` AS t1_r2, `videodata`.`sale` AS t1_r3, `videodata`.`need` AS t1_r4, `videodata`.`usernth` AS t1_r5, `videodata`.`fraction` AS t1_r6, `videodata`.`star` AS t1_r7 FROM `videos` LEFT OUTER JOIN `videodata` ON `videodata`.`video_id` = `videos`.`id` WHERE `videos`.`cid` IN (29, 33, 34) ORDER BY videodata.hits DESC LIMIT 10
      Rendered videos/_sidebar.html.erb (119.0ms)
      Rendered videos/index.html.erb within layouts/application (410.0ms)
    Completed 200 OK in 532ms (Views: 286.4ms | ActiveRecord: 154.0ms)
    [2012-06-26 20:32:20] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
    
  • #7 楼 @Rei 我看了一下,返回的数据现在是正常的,但是不知道为什么不用 id

  • #7 楼 @Rei undefined method `id' for #ActiveRecord::Relation:0xb66472f4

  • 救命啊

  • monaco

  • #3 楼 @Rei undefined method `id' for #ActiveRecord::Relation:0xb66472f4

  • #3 楼 @Rei 没有 videodata.hits 这个字段

  • #1 楼 @Rei 他的复数是 videodata

  • @ywencn

    class ApplicationController < ActionController::Base
      protect_from_forgery
      def self.get_categ
         ...
         categ
      end
    
    
    @@categ=self.get_categ if not defined?@@categ
    end
    

    @@categ 是数组

    然后我在其他控制器里使用 @@categ,为什么只有第一次访问的时候正常,再访问是 @@categ 就为空数组了

  • 哦,其他控制器都是继承的这个控制器

  • #20 楼 @camel 试了一下,很不错

  • #45 楼 @ery 不知道是大一还是大二开始用的,现在因该有两年了

  • #8 楼 @camel command-T