think different
 
Search on x86OSx.com
 
Á¦¸ñ ÀÛ¼ºÀÚ ³»¿ë ÅÂ±× ÄÚ¸àÆ®


  News and Notice
    °øÁö»çÇ×  [¹ö±×½Å°í]
    »õ·Î¿î ¼Ò½Ä
    IRC ´ëÈ­¹æ
    ³» ½ºÅ©·¦



  Community
    ÀÚÀ¯ °Ô½ÃÆÇ 
    OS X ¼³Ä¡ Tips
    OS X ¼³Ä¡ Q&A 
    OS X ¼³Ä¡ Èıâ
    ¸¸´É Q&A 




  RealMacCommunity
    µ¥½ºÅ©Å¾ ÆÐ¹Ð¸®
    ¸ÆºÏ&¾ÆÀÌÆù ÆÐ¹Ð¸®



  Software Forum
    OS X Applications
    Other Applications



  Hardware Forum
    MainBoard
    GraphicCard
    SoundCard
    NetworkCard
    Etc Hardware



  Usefulness
    Ãßõ »ç¿ë±â
    À¯¿ëÇÑ »çÀÌÆ®
    BenchMark DB
    Hardware DB
    È¸¿ø ÀåÅÍ



  Public Data Service
    ÀÚ·á½Ç
    Picture Gallery



x86OSx.com is an open community and we do not offer Mac OS X DVD image files of Apple Inc. Please be aware that doing so is committing an illegal act against Apple Inc. The purpose of this community is to foster information sharing and public use of legal subject matters only.

x86OSx.com



Compatibility Lists


Incompatible Lists








Visitor's Infomation
¿À´Ã ¹æ¹®ÀÚ
¾îÁ¦ ¹æ¹®ÀÚ
Àüü ¹æ¹®ÀÚ
ÃÖ´ë ¹æ¹®ÀÚ



Á¦¸ñ:

Rails °èÃþÇü °Ô½ÃÆÇ ´ä±Û & »èÁ¦ ·ÎÁ÷

À̸§: ¹æÇö¿Àºü
Date: 2009-02-20 08:12Read: 3407 / Vote: 1


Ãßõ ÇϽźеé (1ºÐ)
caveman
 

       



¼ÖÁ÷È÷ ¿ä»çÀÌ ´ä±ÛÀº °ü¸®ÀÚ ´ä±Û·Î ÇϳªÁ¤µµ ´Þ¸®°í..
´ëºÎºÐ Ä¿¹Â´ÏƼ¿¡¼± ´ñ±Û·Î ±â´ÉÀ» ´ë½ÅÇϰí ÀÖ´Â ½ÇÁ¤ÀÔ´Ï´Ù.
±×´ÙÁö ÇÊ¿ä¾ø´Â ºÎºÐÀÌÁö¸¸..
´ë°¡¸® ±¼¸®±â¸¦ À§ÇØ..
·ÎÁ÷À» ¸¸µé¾î º¸¾Ò½À´Ï´Ù.
¤Ð¤Ì Ç÷¡½Ã³ª Motionµîµî ·ÎÁ÷±¸¼º ÀÌÈÄ¿¡ °Ô½ÃÆÇÀ̳ª À¥ÇÁ·Î±×·¡¹Ö¿¡¼­ ·ÎÁ÷À» Çϱä 10³â¸¸ÀÎ°Í °°½À´Ï´Ù.
¸¶Áö¸·À¸·Î µ¥½ºÆ®³×ÀÌ¼Ç 3¶§ Ç÷¡½¬°Ô½ÃÆÇ ¸¸µé°í..¿ÀÀ̱î±â(±×¸²°Ô½ÃÆÇ)ÀÌÈÄ¿¡..
ÀüÇô °èÃþÇü °Ô½ÃÆÇ¿¡ ´ëÇÑ ±â¾ïÀ» ÀØÀºÃ¤..Rails ¿¬¸¶¸¦ À§ÇØ ´Ù½Ã ½ÃµµÇØ º¸¾Ò´Âµ¥.
¤Ð¤Ì

def reply
    @board = Board.find(params[:id])
end

def create_reply
    
    @board = Board.new(params[:board])

    parentThread = @board.thread
    thread = parentThread
    depth = @board.depth + 1
    prevThread = (thread-1)/100 * 100
    
    Board.update_all "thread = thread - 1", "thread < #{parentThread} and thread > #{prevThread}"

    @board.depth = depth
    @board.thread = parentThread - 1
    respond_to do |format|
      if @board.save
        flash[:notice] = 'Board was successfully created.'
        format.html { redirect_to(@board) }
        format.xml  { render :xml => @board, :status => :created, :location => @board }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @board.errors, :status => :unprocessable_entity }
      end
   end
end

ÀÌ ºÎºÐÀº ´ä±Û ¾²±â ºÎºÐÀÔ´Ï´Ù.
¿ø·¡ ±âº» ·ÎÁ÷Àº ref columnÀ» ±âÁØÀ¸·Î ³»¸²Â÷¼ø(desc)Á¤·ÄÀ» Çϴ°ÅÁÒ.
±×¸®°í ºÎ¸ðÀÇ levelÀ» °¡Á®¿Í +1 ÇØÁÖ°í
±× ºÎ¸ðÀÇ refºÎÅÍ »ó´ÜÀ¸·Î ref¸¦ +1¸¦ ÇØÁÖ°í columnÀ» ÀúÀåÇØÁִ°̴ϴÙ.
¸¸¾à 10¹øÀÇ °Ô½Ã±Û¿¡ ´ä±ÛÀ» ÀúÀåÇϸé..
10ºÎÅÍ topÀÌ 22¹øÀ̶ó¸é..11..23¹øÀ¸·Î refÀÌ ¹Ù²ïÈÄ.
ºÎ¸ðÀÇ 10 ref°ªÀ¸·Î ÀúÀåÀÌ µË´Ï´Ù.
±×·±ÈÄ descÁ¤·ÄÀ» Çϸé..
22
.
.
11 level = 0À̸é
<--- 10 ´ä±Û level = 0 + 1·Î 1ÀÌµÇ°í ±× level * 20px·Î ´ä±Û ¾ÆÀÌÄÜÀÌ Á¦¸ñ ¾Õ´Ü¿¡ ±×·ÁÁý´Ï´Ù.
9
.
.
1
¹®Á¦´Â °Ô½Ã±ÛÀÌ ¾öû³ª°Ô ¸¹°í ÇÏ´Ü..Áï ¿¾³¯ÀÇ °Ô½Ã±Û¿¡ ´ä±ÛÀ» ´Ü´Ù¸é..¤Ð¤Ì
¾öû³­ update°¡ µÇ°ÚÁÒ.
ºñÈ¿·üÀûÀÎ ¹æ¹ýÀÔ´Ï´Ù. ^^ ·ÎÁ÷À» º¹ÀâÇÏ°Ô ±¸¼ºÇϸé ÇØ°áÀÌ µÇ°ÚÁö¸¸.
¿¹Àü¿¡ °¡Àå ¸¹ÀÌ ¾²´ø ¹æ¹ýÀÌÁÒ. ¿¾³¯ °Ô½Ã±Û¿£ ´ä±ÛÀ» ´ÞÁö ¾Ê´Â´Ù´Â ÀϹÝÀûÀÎ »ý°¢À¸·Î.
±×·¡¼­ ¹ßÀüµÈ°ÍÀÌ..±×·ìÀ¸·Î °Ô½Ã±ÛÀÌ µî·ÏÀÌ µÇ´Â ¹æ¹ýÀÔ´Ï´Ù.
Áï »õ±Û..level 0ÀÇ ref¸¦..thread·Î Ç¥ÇöÀ» ¹Ù²Ù°Ú½À´Ï´Ù. À­ ¼Ò½º ¼³¸íÀ̱⠶§¹®¿¡.
1000´ÜÀ§·Î..
»õ±ÛÀÌ µî·ÏÀÌ µÇ¸é..
5000
4000
3000
2000
1000
ÀÌ·±½ÄÀ¸·Î µî·ÏÀÌ µÇ°í..±× »õ±Û¿¡ ´ä±ÛÀ» ´Þ¸é ¾Æ¹«¸® ¾÷µ¥ÀÌÆ®¸¦ ÇØºÃÀÚ 1000°³ ÀÌ»ó ³ÑÁö ¾Ê´Â´Ù´Â°ÅÁÒ.
^^ ±×·¯³ª Àú´Â 100°³ Á¤µµµµ ÃæºÐÇÏ´Ù »ý°¢Çؼ­ 100´ÜÀ§·Î ±×·ìÀ» ¼³Á¤Çß½À´Ï´Ù.
ÀÌÁ¦ ¼³¸íÀ» ÇÏÀÚ¸é..
¸ÕÀú..
´ä±Û ¸í·É½Ã¿¡..
def reply
    @board = Board.find(params[:id])
end
ÇØ´ç ºÎ¸ð°Ô½Ã±ÛÀÇ Á¤º¸¸¦ °¡Á®¿Í html¿¡¼­ ´ã¾ÆµÓ´Ï´Ù.
±×·±ÈÄ Á¤ÀåÀ» Çϸé..

def create_reply
    
    @board = Board.new(params[:board])   # ºÎ¸ðÀÇ thread°ª°ú ´ä±ÛÀÇ Á¤º¸¸¦ °¡Á®¿È

    parentThread = @board.thread                # ºÎ¸ð thread°ª º¯¼ö ÁöÁ¤
    thread = parentThread                            #
    depth = @board.depth + 1                      # ´ä±Û¿¡ ÀúÀåµÉ depth °ª

    prevThread = (thread-1)/100 * 100      # ÀÌÀü ±×·ìÀÇ ÃÖ»óÀ§ ºÎ¸ð thread°ª °è»ê
    ¸¸¾à¿¡ 300¹øÀÇ ºÎ¸ð³ª ´ä±Û¿¡ ¶Ç ´ä±ÛÀ» ´Ü´Ù¸é ±â thread°ªºÎÅÍ ÇÏÀ§ÀÇ ±×·ì±îÁö ¿µ¿ªÀ» Á¤ÀÇÇØ¾ß Çϱ⠶§¹®¿¡.
    ÀϹÝÀûÀ¸·Î 100-1Áï 99 / 100À» Çϸé 0.99°¡ µÇ°í ±× °ª¿¡ 100À» °öÇϸé 99°¡ µË´Ï´Ù.
    ÇÏÁö¸¸ Ruby³ª ¿©Å¸ ¾ð¾î¿¡¼­ °è»êÀ» ÇÏ¸é ¼Ò¼ýÁ¡ ÀÌÇϰªÀº Áö¿öÁý´Ï´Ù. Áï 100´ÜÀ§·Î Àß¶ó¹ö¸®´Â°ÅÁÒ.
    100¹øÀÇ ºÎ¸ð±ÛÀ̳ª 99¹øÀÇ ´ä±Û¿¡ 󸮰¡ µÇ¸é 0ÀÌ µË´Ï´Ù.
    4000¹øÀº 3999/100ÀÌ µÇ¸é¼­ 39.99´Â 39°¡ µÇ°í..±× °ª¿¡ 100À» °öÇϸé 3900¹øÀÌ µÇÁÒ.
    Áï ¿øÇϴ´ë·Î ÇÏÀ§ÀÇ ±×·ì thread°ªÀ» ¾òÀ»¼ö ÀÖ½À´Ï´Ù.
    ÇÏÀ§ ±×·ì°ªÀÌ ÇÊ¿äÇÑ ÀÌÀ¯´Â À§¿¡ ¼³¸íÇß´ø ref°ªÀÇ ³»¸²Â÷¼øÀº ºÎ¸ð°ªÀ¸·Î ºÎÅÍ ÃÖ»óÀ§ ref°ªºÎÅÍ +1À» ÇÑÈÄ
    ºÎ¸ðÀÇ ref°ªÀ¸·Î Ãß°¡°¡ µÇ±â ¶§¹®¿¡ À§ÂÊÀ¸·Î ¹Ð¾î¼­ »çÀÌ¿¡ µé¾î°¡´Â ¹æ½ÄÀÌÁö¸¸.
    À̳ðÀº ºÎ¸ð ±×·ì 100ºÎÅÍ ÇÏÀ§°ªÀ¸·Î ÀúÀåÀÌ µÇ´Â°Ì´Ï´Ù.
    400
    399
    398
    397
    .
    .
    300
    299
    298
    297
    296
    200
    199
    198
    100
    ÀÌ·±½ÄÀ¸·Î..
    
    Board.update_all "thread = thread - 1", "thread < #{parentThread} and thread > #{prevThread}"

    ¿©±â°¡ Á¦ÀÏ Áß¿äÇÑ thread ¾÷µ¥ÀÌÆ® ºÎºÐÀÔ´Ï´Ù.
    ^^ ¿ª½Ã³ª ±×·ì´ÜÀ§ÀÇ ¼ö¸¸Å­¸¸ ¾÷µ¥ÀÌÆ®¸¦ ÇÏÁÒ.
   300ÀÇ °ªÀ» ´ëÀÔÇÑ´Ù¸é.

   Á¶°Ç½ÄÀÌ thread < 300(ºÎ¸ð°ªÀÌ ´ëÀÔ)and thread > 200 ÇØ´çµÇ´Â thread °ªÀ» 1¾¿ Áõ°¡.
   300,299,298,297,296
  
   299º¸´Ù À۰ųª 200º¸´Ù Å©´Ù¸é 299..296Àε¥ SET thread = thread - 1 À̱⶧¹®¿¡ 299Àº 1ÀÌ °¨¼ÒÇÑ 298ÀÌ..
   296Àº 295°¡..
   ±×·¸°Ô µÇ¸é 300,<ºó°ø°£>,298..295ÀÌ µÇ°í ¾÷µ¥ÀÌÆ®ÈÄ¿¡..
  
    @board.depth = depth                   # À§¿¡¼­ depth°ª¿¡ 1¸¦ Áõ°¡½ÃÅ´.
    @board.thread = parentThread - 1 # ºÎ¸ðÀÇ °ª¿¡¼­ 1¸¦ °¨¼Ò Áï..299ÀÚ¸®¿¡ µé¾î°¡ ºÎ¸ðÀÇ ¹Ù·Î ¹Ø¿¡ ´Þ¸®°ÔµË´Ï´Ù.

    respond_to do |format|
      if @board.save
        flash[:notice] = 'Board was successfully created.'
        format.html { redirect_to(@board) }
        format.xml  { render :xml => @board, :status => :created, :location => @board }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @board.errors, :status => :unprocessable_entity }
      end
   end
end

ÃÖÁ¾ÀûÀ¸·Î..

300
  >>>>299 ´ä±Û
298
.
.
.
295

^^ óÀ½ ·ÎÁ÷º¸´Ü Áøº¸µÈ °èÃþÇü ´ä±ÛÀÔ´Ï´Ù.
ÇÏÁö¸¸..
¿ª½Ã³ª Á¦ÀÏ Áß¿äÇѰÍÀº..
±Û »èÁ¦ ÀÔ´Ï´Ù.
°¡²û º¸¸é ¿¹Àü¿¡ ´ñ±ÛÀ» Áö¿ì·ÁÇϰųª ¿øº»À» Áö¿ì·Á Çϸé..´ñ±ÛÀÌ ´Þ·ÁÀÖ¾î »èÁ¦°¡ ºÒ°¡´ÉÇÏ´Ù°í ÇÏÁÒ.
¾Æ´Ï¸é °ü¸®ÀÚ¿¡°Ô ¹®ÀÇÇ϶ó°Å³ª Á¤¸» »èÁ¦ÇÒ²¨³Ä°í °æ°íâÀÌ ¶å´Ï´Ù.
°ü¸®ÀÚ°¡ ¼Õ¼ö ÀÏÀÏÀÌ Áö¿ì°í thread°ªÀ» º¯°æÇϰųª..
º¹ÀâÇÑ ·ÎÁ÷À¸·Î ¼öÀÛ¾÷À¸·Î »èÁ¦ÇÒ°ÍÀ» ÇÁ·Î±×·¡¹ÖÇØ¼­..¤Ð¤Ì ½Ã½ºÅÛ¿¡ ºÎÇϰ¡ °É¸®°Å³ª.
¤Ð¤Ì °èÃþÇü°Ô½ÃÆÇÀ¸ ·ÎÁ÷Áß..ÃÖ°íÀÇ °ñÄ¡´Â ¿ª½Ã³ª ´ñ±ÛÀÌ ´Þ·ÁÀÖ´Â ±Û »èÁ¦ÀÔ´Ï´Ù.
ÀÏ´Ü °èÃþÇü°Ô½ÃÆÇ¿¡ ´ëÇÑ Á¤º¸°¡ Àü¹«? ÀÖ±äÇѵ¥ .. ±×´ÙÁö ½â ¸¶À½¿¡ µéÁö ¾Ê´Â..
Àúµµ 2½Ã°£ Á¤µµ °É¸°°Í °°±º¿ä.
¤Ð¤Ì ·ÎÁ÷À» ÁÁÇÏ´Â Àú·Î½ã ¿À·£¸¸¿¡ ¶¡Á» Èê·È½À´Ï´Ù.

Á¶°ÇÀ¸·Î º¯¼ö¿¡ ÀúÀåÇÑÈÄ..
±× º¯¼ö¸¦ ¶ÇÇѹø °Ë»öÈÄ »èÁ¦..(À̺κп¡¼­ ÇØ´ç °Ô½Ã±ÛÀº ¹üÀ§¿¡ µéÁö ¾Ê°í »èÁ¦°¡ ¾ÈµË´Ï´Ù. ¿Ö³Ä¸é..
°°Àº depthÀÇ ±ÛÀ» ¹èÁ¦Çϱâ À§Çؼ­ÁÒ)
ÀÌÁ¦ ÇØ´ç±ÛÀ» »èÁ¦ÇÕ´Ï´Ù.
±×·±ÈÄ ´Ù½Ã Á¶°ÇÀ¸·Î º¯¼ö¿¡ ÀúÀåÇÑÈÄ.
º¯¼ö·¹ÄÚ´õ°ªÀ» ¾÷µ¥ÀÌÆ®..
^^

def destroy
    
    @board = Board.find(params[:id])  # »èÁ¦ÇÒ column°ªÀ» Àü´Þ ¹ÞÀ½.
    
    selfThread = @board.thread            # ÇØ´ç thread°ª ¹é¾÷
    thread = selfThread                        # Çѹø´õ
    afterThread = selfThread + 1          # 1¸¦ ´õÇÑ thread°ª ¹é¾÷
    depth = @board.depth                    # depth°ª ¹é¾÷
    prevThread = (thread-1)/100 * 100   # ¿µ¿ªÀ» À§ÇØ ÇÏÀ§±×·ì thread°ª ±¸ÇÔ
    
    @boards = Board.find(:all, :order => "thread DESC", :conditions => "thread < #{selfThread} and thread > #{prevThread} and depth > #{depth}")
    ¿©±â¼­ Áß¿äÇÕ´Ï´Ù.
    °°Àº depth¸¦ ¹èÁ¦Çϱâ À§Çؼ­ »óÀ§ depth°ªÀ» Á¶°ÇÀ¸·Î ÇÕ´Ï´Ù.
    298¹øÀ̰í depth°¡ 1À̸é.
    300-0
    299-1
    298-1 <- ÇØ´ç »èÁ¦±Û
    297-2 <- 298ÀÇ ´ä±Û »èÁ¦¿¡ ÇØ´çµÊ
    296-1 <- ÇØ´ç ¾ÈµÊ, °°Àº depth Á¶°Ç¿¡ ÇØ´ç ¾ÈµÊ
    295-1 <- »óµ¿
    294-2 <- 295ÀÇ ´ä±ÛÀÌÁö¸¸ depth°¡ »óÀ§À̱⿡ Á¶°Ç¿¡´Â ÇØ´ç
    293-1 <- ÇØ´ç¾ÈµÊ
    Áï..WHERE thread < 298 and thread > 200 and depth > 1  # ÇØ´ç »èÁ¦±ÛÀº 300±×·ìÀ̰í..300..200ÀÇ ¿µ¿ªÀÔ´Ï´Ù.
    À§ÀÇ Á¶°Ç¿¡´Â
    297,294 ÇØ´çµË´Ï´Ù.

    if @boards.length > 0   # Á¶°Ç¿¡ ÇØ´ç ¾ÈµÉ¶§ º»ÀÎ ±Û¸¸ »èÁ¦¸¦ À§ÇØ.
      for board in @boards
        if (thread-1) == board.thread  
          board.destroy
          thread -= 1
        end
      end
    end
    ¾Æ±î Á¶°Ç¿¡ ÇØ´çµÇ´Â °ªÀ» ´ëÀÔÇϸé.
    (thread-1) == board.thread thread´Â »èÁ¦µÇ´Â ±ÛÀ» 298°ª..board.thread´Â Á¶°Ç¿¡ ³»¸²Â÷¼øÀ¸·Î °¡Á®¿Â 297
     298-1 == 297 Á¶°ÇÀÌ ÂüÀ̱⠶§¹®¿¡ »èÁ¦µË´Ï´Ù.
     ±×¸®°í thread°ªÀº 1ÀÌ °¨¼ÒµË´Ï´Ù. 297
     ´Ù½Ã ´ëÀÔ. 297-1 À̹ø board.thread°ªÀº 294ÁÒ. 297-1 == 294 Á¶°ÇÀÌ °ÅÁþÀ̱⶧¹®¿¡ »èÁ¦ ½ÇÇàÀÌ ¾ÈµË´Ï´Ù.
     Áï.
     ´ñ±ÛÀ̰ųª..±× ´ä±ÛÀÇ ´ä±Û..°è¼Ó À̾îÁø ´ä±ÛÀ̸é Á¶°Ç¿¡ ÇØ´çµÇ¾î¼­ »èÁ¦°¡ µÇ°í.
     Á¶°Ç¿¡ ÇØ´çµÇÁö ¾Ê´Â ´Ù¸¥ ±ÛÀÇ ´ä±ÛÀº »èÁ¦°¡ µÇÁö ¾Ê½À´Ï´Ù. ¤Ð¤Ì
    
    @board.destroy  # ÇØ´ç »èÁ¦±ÛÀ» ÀÌÁ¦¾ß »èÁ¦ÇÕ´Ï´Ù.
    298°ú ´ä±Û 297ÀÌ »èÁ¦°¡ µÇ¾úÁÒ
    ¿©±â¼­ºÎÅ͵µ Áß¿ä ^^ thread°ªÀ» ´Ù½Ã Á¤·ÄÇÏ´Â °Ì´Ï´Ù.

    if selfThread % 100 != 0 # À̺κÐÀº ¸¸¾à¿¡ ±×·ìÀÇ ºÎ¸ð¸é ½ÇÇàÀ» ÇÏÁö ¾Ê´Â´Ù ÀÔ´Ï´Ù. 100,200..³ª¸ÓÁö °ªÀÌ 0ÀÌ¸é ±×·ìºÎ¸ðÀÇ °ª.
      @boards = Board.find(:all, :order => "thread DESC", :conditions => "thread < #{afterThread} and thread > #{prevThread}")

      ¾Æ±î ¹é¾÷Çß´ø º¯¼ö¸¦ »ç¿ëÇÕ´Ï´Ù.
      WHERE thread < 299 and thread > 200  # afterThread´Â ºÎ¸ð thread+1ÇѰÍÀ̱⠶§¹®¿¡ 299°¡ µË´Ï´Ù.
      ÀÌ·¸°Ô Á¶°ÇÀ» ´Þ¸é
      298
      .
      .
      200  ÀÌ Á¶°Ç ¿µ¿ªÀÌ µÇÁÒ. ¿Ö ±×·ìÀÇ ºÎ¸ð°ªÀÌ ¹èÁ¦ Ç߳ĸé. ¾îÂ÷ÇÇ À§ÀÇ »èÁ¦·ÎÁ÷¿¡¼­ ±×·ìÀÌ »ç¶óÁý´Ï´Ù.
      ±×·¯´Ï ¾÷µ¥ÀÌÆ®°¡ ÇÊ¿ä ¾ø½À´Ï´Ù.
    
      for board in @boards
        board.update_attribute(:thread, selfThread)
        selfThread -= 1
      end
    end
    À§¿¡ »èÁ¦·ÎÁ÷ ½ÇÇàÈÄ..Á¶°Ç¿¡ ÀÇÇØ °Ë»öÀ» Çϸé.
    Á¶°Ç¿¡ ÇØ´çÀÌ ¾ÈµÈ °°Àº depth±ÛÀ̳ª Á¶°Ç¿¡ ÇØ´çµÇ¾úÁö¸¸ »èÁ¦°¡ ¾ÈµÈ ±ÛÀÌ ÇØ´çµÇÁÒ.

    296-1 <- ÇØ´ç ¾ÈµÊ, °°Àº depth Á¶°Ç¿¡ ÇØ´ç ¾ÈµÊ
    295-1 <- »óµ¿
    294-2 <- 295ÀÇ ´ä±ÛÀÌÁö¸¸ depth°¡ »óÀ§À̱⿡ Á¶°Ç¿¡´Â ÇØ´ç
    293-1 <- ÇØ´ç¾ÈµÊ

    ´ëÀÔÀ» ÇÕ´Ï´Ù.
    selfThreadÀÇ ½ÃÀÛÀº 298 <- »èÁ¦µÇ¾úÀ¸´Ï ¿©±â¼­ ºÎÅÍ ¸¸µé¾î¾ß °ÚÁÒ.
    296 °Ô½Ã±Û¿¡ 298·Î ¾÷µ¥ÀÌÆ®ÈÄ selfThread -= 1 297ÀÌ µË´Ï´Ù.
    295 <- 297
    294 <- 296
    293 <- 295
    
    »èÁ¦ÇÒ°ÍÀº ´Ù »èÁ¦ÇÏ°í ±×·ì³»ÀÇ ÇÏÀ§¸¦ ´Ù½Ã °ªÁ¤·ÄÇѰ̴ϴÙ.
    298ÀÌ »èÁ¦°¡ µÇ¾úÀ¸´Ï..298ºÎÅÍ ½ÃÀÛÇØ¼­ ¾÷µ¥ÀÌÆ®¸¦ ÇßÁÒ.

    respond_to do |format|
      format.html { redirect_to(boards_url) }
      format.xml  { head :ok }
    end
  end

^^
±»ÀÌ °èÃþÇü °Ô½Ã±ÛÀ» ¸¸µé ÇÊ¿ä´Â ¾ø½À´Ï´Ù.
ÇÏÁö¸¸..
ÀÌ ·ÎÁ÷À» ÀÌÇØÇϽŴٸé..
´Ù¸¥ DBÀÛ¾÷Àº ½ÄÀºÁ× ¸Ô±â¶ó ¿©°Üµµ µÉ¸¸Å­.
À¥ÇÁ·Î±×·¡¹Ö ·ÎÁ÷ÀÇ ²ÉÀÎ..
°èÃþÇü°Ô½ÃÆÇ ´ä±Û°ú »èÁ¦ ºÎºÐÀ̾ú½À´Ï´Ù.
^^



¿£Åä / ½ãºñ / Æúºñ / shareX.divshare.com
by tommyyo & bitzter
       
»ßµµ¸®  
ruby ÄÚµå ¹®¹ýÀÌ ½ÉÇÃÇϳ׿ä. Àß º¸¾Ò½À´Ï´Ù.
2009-02-20
08:32:09



 

¹æÇö¿Àºü  
Áß¿äÇѰÍÀº ·ÎÁ÷ÀÔ´Ï´Ù.
¸ð¸£´ø »óȲ¿¡¼­ ¿ä±¸¹ÞÀº °á°ú°ªÀ» ¾ò±â À§ÇØ ½º½º·Î ÃÖ»óÀÇ ·ÎÁ÷À» ±¸ÇöÇϴ°ÍÀÌ ¾î¶»°Ô º¸¸é ÇÁ·Î±×·¡¹ÖÀÇ ÇÙÀ̶ó ÇÒ¼öÀÖÁÒ.
ÄÚµùÀº ^^ ³ë°¡´Ù°í..
ÀϺη¯ ÀÖ´Â ¼Ò½º(-.- Rails´Â Àß ¾ø´øµ¥¿ä..) ¾²Áö ¾Ê°í.
»õ·Ó°Ô »ý°¢À» ÇØºÃ½À´Ï´Ù.
CF¸¸ ¸ôµÎÇØ¼­ ÇÏ´Ù°¡..
¿Ã¸¸¿¡ ^^
2009-02-20
10:36:45



 

۸¶  
¿Ü°èÀÎÀ̽ñº¿ä...¤Ð.¤Ì
2009-02-20
11:01:49



 

freeman  
Á¶Àºµ¥¿ä.. ¤¾¤¾ ¼ýÀÚ´Â Á¤¸» ¸øÇÏ´Â°Ô ¾ø¾î¿ä.. ^^;
2009-02-20
12:14:37



 

¹æÇö¿Àºü  
¼öÁ¤·ÎÁ÷ÀÔ´Ï´Ù. ¤Ð¤Ì
¹ö±×´Â ¾Æ´Ï°í. È¿·üÀûÀÎ.

¸Ç Çϴܺκп¡ »èÁ¦ÈÄ thread ÀçÁ¤·Ä ºÎºÐ¿¡¼­ °Ë»öÈÄ ÀÏÀÏÀÌ ¾÷µ¥ÀÌÆ®¸¦ Çߴµ¥ ^^

Board.update_all "thread = thread + #{del_count}", "thread < #{afterThread} and thread > #{prevThread}" if selfThread % 100 != 0

^^ ¾îÂ÷ÇÇ ´ä±ÛÀÌ Áö¿öÁø´Ù´Â°ÍÀº ÀÚ½ÅÀ» Æ÷ÇÔÇØ ¼øÂ÷ÀûÀ¸·Î »èÁ¦°¡ µÇ±â ¶§¹®¿¡ »èÁ¦ÇÑ column¸¸Å­ ÇÏÀ§ columnÀÇ thread¸¦ Áõ°¡ ½ÃŰ¸é µË´Ï´Ù.
del_count = 0 À̶õ º¯¼ö¸¦ Ãʱ⿡ ¼³Á¤.
´ä±ÛÀÌ Áö¿öÁö´Â..
if @boards.length > 0 # Á¶°Ç¿¡ ÇØ´ç ¾ÈµÉ¶§ º»ÀÎ ±Û¸¸ »èÁ¦¸¦ À§ÇØ.
for board in @boards
if (thread-1) == board.thread
board.destroy
thread -= 1
del_count += 1 <-- »èÁ¦¼ö Áõ°¡
end
end
end

´ÙÀ½¿¡ ÀÚ½ÅÀ» Áö¿ï¶§..
@board.destroy
del_count += 1 <- Áõ°¡

^^

if selfThread % 100 != 0
@boards = Board.find(:all, :order => "thread DESC", :conditions => "thread < #{afterThread} and thread > #{prevThread}")

for board in @boards
board.update_attribute(:thread, selfThread)
selfThread -= 1
end
end

À̺κÐÀÌ

Board.update_all "thread = thread + #{del_count}", "thread < #{afterThread} and thread > #{prevThread}" if selfThread % 100 != 0

ÀÌ·¸°Ô ^^
2009-02-20
16:41:19



 

caveman  
Çê ¹æÇö¿Àºü´Ô ¿µ»óÂÊ ÇϽôºР¾Æ´Ï¾ú¾î¿ä. °³¹ßÀÚÀÎÁÙÀº »ý°¢µÎ ¸øÇ߳׿ë. ^^
2009-02-20
18:16:28



 

¹æÇö¿Àºü  
¿ø·¡ ÄÄÅÍ´Â ¾î·ÈÀ»¶§ºÎÅÍ Çϰí..¹Ì¼úÀ» Àü°øÇÏ·Á´Ù ´«ÀÌ Àû³ì»ö¾àÀ̶ó ÄİøÀ» Àü°øÇß½À´Ï´Ù. ^^
¿µ»ó(ÃÔ¿µ&ÆíÁý)Âʰú ¼ÒÇÁÆ®¿þ¾îºÐ¾ß¸¦ °â¾÷ÇÕ´Ï´Ù.
2009-02-20
18:34:30



 

Àǰß(ÄÚ¸àÆ®)À» ÀÛ¼ºÇÏ½Ç ¼ö ¾ø½À´Ï´Ù. ÀÌÀ¯: ±ÇÇÑÀÌ ¾ø´Â ȸ¿ø·¹º§

       
Copyright 1999-2013 Zeroboard / skin by DQ'Style

About Us          Terms of Use          Privacy Policy

ÀÌ ÀúÀÛ¹°Àº Å©¸®¿¡ÀÌÆ¼ºê Ä¿¸ÕÁî ÄÚ¸®¾Æ ÀúÀÛÀÚÇ¥½Ã-ºñ¿µ¸® 2.0 ´ëÇѹα¹ ¶óÀ̼¾½º¿¡ µû¶ó ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.
All user-submitted text and content on this website is licensed under a Creative Commons Attribution-Noncommercial 2.5 License in Korea unless otherwise noted.

Copyright © 23,Aug 2005 x86OSx.com 3rd season, All rights reserved.
Creative Commons License    

Session Excuted : 0.000      
Connect Checked : 0.002      
Query Excuted : 0.004      
PHP Excuted : 0.014      
Check Lists : 0.003      
Skins Excuted : 0.066      
Total Excuted Time : 0.087