class Company
  has_many :stores
end
...

Ruby Active Record getting uniqu...

by kibyegn.myopenid.com, February 03, 2012 01:40, 1 refactoring, tagged with rails, short clean ruby, active record

I still think I could make ...

6d071ab3b1a56ebe43df404356331163 Talk
layouts = Dir.glob("_layouts/*")
layouts.each do |layout|
  layout.gsub!(/^_layouts\/(.*)\..*$/, '\1')
...

Ruby List the files in a directo...

by Aziz Light, February 01, 2012 08:46, 2 refactorings, tagged with ruby, ruby1.9

The title says it all, I'm ...

D69bd6b89f0c9204eed89de9d7ee4632 Talk
Weeks = [["2012-01-15","2012-01-22"], ["2012-01-22","2012-01-29"], ["2012-01-29","2012-02-05"],["2012-02-05","2012-02-12"], ["2012-02-12","2012-02-19"], ["2012-02-19","2012-02-26"]]  

...

Ruby clean the code

by https://www.google.com/accounts/o8/id?id=AItOawlaTnwjQ00W1XCRaUEGIonvKgruTMebfak, January 30, 2012 03:54, 4 refactorings, tagged with ruby, rails 3

Plz help me clean the code
...

55502f40dc8b7c769880b10874abc9d0 Talk
M = [["a", "b"], ["c", "d"], ["e", "f"]]

x = []
...

Ruby Array parsing in a block

by https://www.google.com/accounts/o8/id?id=AItOawmWMRp7fAci9domcwhxD3fNikoTak9bkYc, January 26, 2012 05:59, 1 refactoring, tagged with arrays, blocks, loops, array syntax

x should be ["a","c","e"] i...

55502f40dc8b7c769880b10874abc9d0 Talk
if $0 == __FILE__
        total = 0

...

Ruby Euler Problem 2 solution

by https://www.google.com/accounts/o8/id?id=AItOawkD4xFlDWBQgag82x1DXUSXIYd_s8Ca8B4, January 24, 2012 18:43, 3 refactorings

Sorry if I shouldn't be pos...

55502f40dc8b7c769880b10874abc9d0 Talk
When /^I request test urls with headers "([^"]*)" "([^"]*)"$/ do |accept, headers|
  header_map = create_header_map_from_string(headers)
  test_urls = load_fixture("test-urls1.txt")
...

Ruby Looping over a file

by https://www.google.com/accounts/o8/id?id=AItOawnvtFGh-r9ibK5ZHTYiZh2UzxDww7-bwI0, January 11, 2012 09:15, 1 refactoring

The puts doesn't happen unt...

55502f40dc8b7c769880b10874abc9d0 Talk
# Start of file, showing the name of the application
# Size, and all relevent parts of the title

...

Ruby Address Book

by https://www.google.com/accounts/o8/id?id=AItOawkiJON4MFJ9bopD8IvwQ1pbpH3ag7yrtnI, December 28, 2011 07:36, 5 refactorings, tagged with ruby, methods, regexp, regular expression

This is a fairly simple add...

55502f40dc8b7c769880b10874abc9d0 Talk
ALPHA = ('a'..'z').to_a

def nextAlpha letter
...

Ruby String Incrementing

by caustic-interface.myopenid.com, December 20, 2011 18:24, 11 refactorings

It's intended to increment ...

55502f40dc8b7c769880b10874abc9d0 Talk
def battle
  # do something 
  if result=self.save
...

Ruby Unnecessary assignment near...

by https://www.google.com/accounts/o8/id?id=AItOawldXGtOvAVQC5k5Z7Y71zO75UzIQ98K5a0, December 12, 2011 07:36, 5 refactorings, tagged with return, observers

It feels like the assignmen...

55502f40dc8b7c769880b10874abc9d0 Talk
>> %w(Pending Processing Executed Canceled).each_with_index.map {|v, i| i}
=> [0, 1, 2, 3]

Ruby Get array of indexes from g...

by jibiel, December 08, 2011 00:18, 5 refactorings, tagged with rails, dry, ruby-1.9.2

Using it :in validates_incl...

4b3896c9b63e756621efa3746c32e91b Talk
def self.generate_required_data(orders)
      all_the_orders = []
      orders.each do |order|
...

Ruby Building an array from data...

by juo100@gmail.com, December 05, 2011 02:36, 4 refactorings, tagged with shorten

Just interested to see how ...

B543a43dc8cb0aae562278484db60d25 Talk
#more elegante way? 
sector = Sector.create(:name => name) unless sector = Sector.find_by_name(sector)

Ruby more elegant way

by RoadHouse, December 01, 2011 09:52, 5 refactorings, tagged with ruby, activerecord, rails3

no ideas about it, rails 3....

70089e712ed13abb99bec89bd5bfba77 Talk
@topic = if (defined? @parent.topic) then
                 @parent.topic
               else
...

Ruby Ugly ruby if statement.

by acreek.myopenid.com, November 29, 2011 11:51, 5 refactorings, tagged with ruby1.9, rails3

I know there has to be a be...

55502f40dc8b7c769880b10874abc9d0 Talk
#MM-YYYY
"2011-10".split("-").reverse.join("/") => "10/2011"

Ruby parsing date

by RoadHouse, November 24, 2011 12:40, 3 refactorings, tagged with ruby, date

anyone has the better solut...

70089e712ed13abb99bec89bd5bfba77 Talk
require_relative 'nice_stuff'

class Sheet
...

Ruby strange method

by Pyro, November 24, 2011 03:10, No refactoring, tagged with ruby, constants, inheritance

I have strange feeling abou...

547616d5e4aaee90426e7051dd766a5a Talk
#!/usr/bin/env ruby
# encoding: utf-8

...

Ruby Tasks list

by Aziz Light, November 16, 2011 20:02, 6 refactorings, tagged with command line, ruby

This script takes one argum...

D69bd6b89f0c9204eed89de9d7ee4632 Talk
Top Selling SkinB5 Acne Treatment that ACTUALLY WORKS! Powerful Vitamin B5 fast acne cure normalizes skin oil production. Best natural acne products that cure & prevent acne, whiteheads, blackheads and oily skin.
http://www.skinb5.com/order.asp

Ruby Best Acne Products

by https://www.google.com/accounts/o8/id?id=AItOawmmt5yWC8Y3fZd7Y3mAVyx_I3ASnzslJBw, November 12, 2011 03:18, No refactoring, tagged with Best Acne Product, Best Acne Treatment, Best Acne Cure

Top Selling SkinB5 Acne Tre...

55502f40dc8b7c769880b10874abc9d0 Talk
Best Seller SkinB5 Acne Treatment! Powerful Vitamin B5 fast acne cure normalizes skin oil production. Best natural acne products that cures & prevents acne, whiteheads, blackheads and oily skin.
http://www.skinb5.com/acne-products.asp

Ruby Acne Products, Acne Product

by https://www.google.com/accounts/o8/id?id=AItOawmmt5yWC8Y3fZd7Y3mAVyx_I3ASnzslJBw, November 12, 2011 03:17, 6 refactorings, tagged with Acne Product, Acne Products, Body Acne

Best Seller SkinB5 Acne Tre...

55502f40dc8b7c769880b10874abc9d0 Talk
Top Selling SkinB5 Acne Treatment that ACTUALLY WORKS! Powerful Vitamin B5 fast acne cure normalises skin oil production. Best natural acne products that cures & prevents acne, whiteheads, blackheads and oily skin.
http://www.skinb5.com/natural-acne-treatment.asp

Ruby Natural Acne Treatment, Nat...

by https://www.google.com/accounts/o8/id?id=AItOawmmt5yWC8Y3fZd7Y3mAVyx_I3ASnzslJBw, November 12, 2011 03:16, No refactoring, tagged with Acne Treatment, Natural Acne Treatment, Treatment for Acne

Top Selling SkinB5 Acne Tre...

55502f40dc8b7c769880b10874abc9d0 Talk
Top Seller SkinB5 Acne Treatment that ACTUALLY WORKS! Powerful Vitamin B5 fast acne cure normalises skin oil production. Best natural acne products that cures & prevents acne,whiteheads, blackheads and oily skin.

Ruby Treatment for Acne, Best Ac...

by https://www.google.com/accounts/o8/id?id=AItOawmmt5yWC8Y3fZd7Y3mAVyx_I3ASnzslJBw, November 12, 2011 03:12, No refactoring, tagged with Acne Product, Acne Treatment, Acne Treatments

Top Seller SkinB5 Acne Trea...

55502f40dc8b7c769880b10874abc9d0 Talk
Proven Top Seller SkinB5 Acne Treatment that ACTUALLY WORKS! Powerful Vitamin B5 fast acne cure normalizes skin oil production. Best natural acne 
products for face acne and body acne. Stops pimples & oily skin.

Ruby Acne Treatment, Acne, Body ...

by https://www.google.com/accounts/o8/id?id=AItOawmmt5yWC8Y3fZd7Y3mAVyx_I3ASnzslJBw, November 12, 2011 03:10, No refactoring, tagged with Acne, Acne Control, Acne Product, Acne Products, Acne Treatment

Proven Top Seller SkinB5 Ac...

55502f40dc8b7c769880b10874abc9d0 Talk
cachedResults = {}

expensiveFunction.__index = 
...

Ruby In Lua, why does t.k not wo...

by https://www.google.com/accounts/o8/id?id=AItOawmSrR_IfFuPDvqWETu3W8vcWWo1-md_RZA, November 10, 2011 21:54, 5 refactorings, tagged with lua

Consider the below code. Wh...

55502f40dc8b7c769880b10874abc9d0 Talk
def set_name
    deal_date = self.deal_date
    if (4..12).to_a.include?(self.deal_date.month)
...

Ruby Refactor this code

by https://www.google.com/accounts/o8/id?id=AItOawl-DJ5xgYVFKrrLOGZqwCiGLkx38LeB1cU, November 10, 2011 21:43, No refactoring, tagged with ruby, rails3

Please refactor this code.....

55502f40dc8b7c769880b10874abc9d0 Talk
"\none\n two\n  three".scan(/^( *)\w+/).flatten #=> ["", " ", "  "]

Ruby Get rid of useless `flatten`

by Shamaoke, November 06, 2011 02:11, 5 refactorings, tagged with ruby, array, scan

Hi.

I want to get the ar...

E4c1e34040468dff738dda2a3349a36a Talk
Parameters: {"inventory_order"=>{
  "inventory_order_items_attributes"=>{
    "0"=>{"inventory_item_id"=>"2", "quantity"=>"1"}, 
...

Ruby Group Nested Paramaters

by https://www.google.com/accounts/o8/id?id=AItOawkqv2FztAX85ggbYpnN0soQPaUdOEPrtFM, November 02, 2011 10:36, 1 refactoring, tagged with array grouping

I have a form ( model = Inv...

55502f40dc8b7c769880b10874abc9d0 Talk