1
2
3
4
module Menus
  
 def self.getValidPositiveNumber
...

Ruby Good way to output menu wit...

by tragicdancer.myopenid.com, August 30, 2010 17:28, 1 refactoring, tagged with ruby

What would be the best or a...

Avatar Talk
1
2
3
4
class ProductsController < ApplicationController  
  helper_method :sort_column, :sort_direction
  
...

Ruby Moving Code from Controller...

by Omer Jakobinsky, August 30, 2010 12:22, No refactoring, tagged with rails

Hi all,
I know that the c...

A289beedc9fd9fdeaaa905bd755f6f98 Talk
1
2
3
4
module Menus
  
  class Main_Menu
...

Ruby Help with module?!

by tragicdancer.myopenid.com, August 26, 2010 11:48, 3 refactorings

Hi Im working on a program ...

Avatar Talk
1
2
3
4
<% if I18n.locale == :pl %>
    <%= link_to 'PL', { :locale => :pl }, :class => "language_selected" %> | <%= link_to 'ENG', { :locale => :en } %>
<% else %>
...

Ruby Language Selection

by Omer Jakobinsky, August 25, 2010 10:47, 3 refactorings, tagged with ruby, rails

Hi, I'm sure this is the mo...

A289beedc9fd9fdeaaa905bd755f6f98 Talk
1
2
3
4
  def format_category_list(sub_categories)
    count = sub_categories.count
    list = ""
...

Ruby Generating a list of 3 entr...

by KJF, August 24, 2010 11:15, 2 refactorings, tagged with rails

I have this function in my ...

A529b78031f700ca2005bdbd1af5ee7b Talk
1
2
3
4
def load_feeds 
  #feed url
  po = 'http://feed.kennisnet.nl/Basisonderwijs'
...

Ruby Fetch and parse feeds with ...

by https://www.google.com/accounts/o8/id?id=AItOawmdo5pHB7lc_C5OJPTw3EPT2380GAzewqU, August 23, 2010 22:18, 2 refactorings, tagged with feedzirra

Function to fetch and parse...

Avatar Talk
1
2
3
4
@cart = CartItem.sum(:quantity, :group => "cart_id")
new_ids = []
@cart.each do |c|
...

Ruby Sum of the Column

by Paddy, August 21, 2010 13:49, 5 refactorings

What i want to do is, find ...

6de3daa3f91b7169c85df7702b4fb1d4 Talk
1
2
3
4
uri = URI.parse(the_uri)
hash = CGI.parse(uri.query)
hash["size"] = size.to_s
...

Ruby Set value of key in uri

by Hakon1, August 21, 2010 10:59, 5 refactorings, tagged with rails

Is there some magic i don't...

3764c38cac5f613c92a87b8c3813a3ad Talk
1
2
3
4
openid_mapping = {
  :email => ["email", "http://axschema.org/contact/email"], 
  :name => ["fullname", "http://axschema.org/namePerson"]
...

Ruby Hash + Array refactor

by Oriol, August 19, 2010 17:56, 3 refactorings, tagged with ruby, hash, array, openid, sreg, axschema

This actually works but I w...

E4679be8d7d2484f9c0b8c4df71f4d2a Talk
1
2
3
4
def images
  image = Kernel.const_get(params[:class].capitalize).find_by_link(params[:id]).image
  if image.nil?
...

Ruby Rails DB Field to Image Out...

by https://www.google.com/accounts/o8/id?id=AItOawkuoairsv4fB9xuwKcC953iLBxlElFcjEA, August 18, 2010 22:19, 2 refactorings

This is a rails action that...

Avatar Talk
1
2
hash = {}
array.each { |key| hash[key] = func(key) }

Ruby How to make it more idiomatic?

by AlekSi, August 16, 2010 11:58, 6 refactorings, tagged with ruby, idiomatic, idioms

Can you make this code more...

Af19cd0c0141bf7d6b42516706eb1d1d Talk
1
2
3
4
sum = 0
self.items.each { |item| sum += item.fragments.count }
      
...

Ruby Calculate sum of items in a...

by FRKT, August 16, 2010 08:12, 4 refactorings, tagged with array hash

I'm pretty sure I'm not doi...

28e9d19f948f2367b2da007e7ad858fd Talk
1
2
3
4
class ItemsController < ApplicationController
  def create
    @product = Product.find(params[:product_id])
...

Ruby Add product to cart, reject...

by Arivudainambi, August 14, 2010 09:01, 2 refactorings, tagged with rails, efficiency

I've a simple cart applicat...

37f51e0d0c7a647a45c89fdf96cb4b37 Talk
1
2
3
4
class MessagesController < ApplicationController
  before_filter :require_user, :only => [:new, :edit, :destroy]
  before_filter :redirect_if_doesnt_exist, :only => [:show]
...

Ruby Ruby on Rails controller re...

by https://www.google.com/accounts/o8/id?id=AItOawmw_k87TBAgAYJIdT-LlXDh4s6QvcLkk88, August 13, 2010 21:49, 1 refactoring, tagged with rails controller

What can be done to simplif...

Avatar Talk
1
2
3
if @user && @user.role && @user.role.eql?('user') && @user.user_group
  @group_name = @user.user_group.name
end

Ruby Handling NoMethodError

by chipcastle.myopenid.com, August 13, 2010 17:30, 4 refactorings

It seems to me that there s...

31e2b397e15442a2d3ba42db7bd4584e Talk
1
2
3
4
// generate code for parsing an array of array
tab = [ ["a","b"] , ["c","e"] , ["d"]]

...

Ruby Generate code for parsing a...

by bussiere, August 11, 2010 12:51, 1 refactoring, tagged with array ruby metaprogrammation parsing generation

It's dirty but it's work...

590ab8e31e515d6d8666c8b81f3a1317 Talk
1
2
3
4
# Array of LDAP group names
@group_names = []

...

Ruby Refactor array of hashes

by chipcastle.myopenid.com, August 09, 2010 22:44, 1 refactoring, tagged with ruby array hash flatten select

The code below gives me wha...

31e2b397e15442a2d3ba42db7bd4584e Talk
1
2
3
4
def is_translated?
    if !params[:lang].blank? and params[:lang].eq?('en')
      return true
...

Ruby too many ifs and ands

by corroded, August 09, 2010 10:25, 5 refactorings, tagged with rails ruby

there are too many if then ...

A53cdbd5cbc6e9fc944d35331a32e63c Talk
1
2
3
4
    def include_class?(obj_class)
      stack = []
    
...

Ruby hash.include_class?, recursive

by unixcharles, August 09, 2010 00:20, 1 refactoring, tagged with short, ruby

I have a hash like this one...

23e6178f295b9cb7473d44d9e501a2b3 Talk
1
2
3
4
class ModernWarfare2 < Challenge

  GAME_MODES = ['Capture the Flag', 'Demolition', 'Domination', 'Headquarters', 'Sabotage', 'Search and Destroy']
...

Ruby List of randomized items fr...

by teddyzetterlund, August 06, 2010 12:38, 1 refactoring

I've removed the code that ...

44bf7541ad28af4ae7932914c048c69c Talk
1
2
3
4
    if @user.valid?
      ....
      result = create_customer
...

Ruby Redundant Else Clauses

by https://www.google.com/accounts/o8/id?id=AItOawmRvMhcLFwL72d7b-9gx7YpThiobwkY3Co, August 05, 2010 19:19, 3 refactorings, tagged with rails, conditionals

Hi,
I have a controller wh...

1772298f2d14152c13bbd3221e6ab6ec Talk
1
2
3
4
# link_categories has_many links
create_table "link_categories", :force => true do |t|
  t.string   "name"
...

Ruby Find records according to r...

by https://www.google.com/accounts/o8/id?id=AItOawl_CInyr4p6Fw9fCXT3DYEGIiMyGOQDomw, August 02, 2010 18:43, 1 refactoring, tagged with rails, ruby, activerecord, sql

I have a method (LinkCatego...

Avatar Talk
1
2
3
4
require 'uri'
require 'net/http'
require 'net/https'
...

Ruby Ugly net/http code

by spaghetticode, August 02, 2010 06:37, No refactoring, tagged with ruby, net/http

I am not an expert of the n...

A3897deec9b1dbc6def9f5dfcb58bb60 Talk
1
2
3
4
require 'ruby_camping'
require 'camping_guests'

...

Ruby Help!! undefined method for...

by tragicdancer.myopenid.com, July 27, 2010 10:06, 5 refactorings, tagged with ruby

Hi! Ive posted before about...

Avatar Talk
1
2
3
4
module Rack
  class SslBlock
    def initialize app, options = {}
...

Ruby Rack Middleware

by https://www.google.com/accounts/o8/id?id=AItOawkgnP7evEXOMIOnxq71Y4yEhDFN2oe3qi4, July 26, 2010 14:34, 2 refactorings, tagged with rack, middleware

any optimisations on this l...

Avatar Talk