1 2 3 4
class ProductsController < ApplicationController helper_method :sort_column, :sort_direction ...
Ruby Moving Code from Controller...
Hi all,
I know that the c...
1 2 3 4
module Menus class Main_Menu ...
Ruby Help with module?!
Hi Im working on a program ...
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
Hi, I'm sure this is the mo...
1 2 3 4
def format_category_list(sub_categories) count = sub_categories.count list = "" ...
Ruby Generating a list of 3 entr...
I have this function in my ...
1 2 3 4
def load_feeds #feed url po = 'http://feed.kennisnet.nl/Basisonderwijs' ...
Ruby Fetch and parse feeds with ...
Function to fetch and parse...
1 2 3 4
@cart = CartItem.sum(:quantity, :group => "cart_id") new_ids = [] @cart.each do |c| ...
Ruby Sum of the Column
What i want to do is, find ...
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
Is there some magic i don't...
1 2 3 4
openid_mapping = { :email => ["email", "http://axschema.org/contact/email"], :name => ["fullname", "http://axschema.org/namePerson"] ...
Ruby Hash + Array refactor
This actually works but I w...
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...
This is a rails action that...
1 2
hash = {} array.each { |key| hash[key] = func(key) }
Ruby How to make it more idiomatic?
Can you make this code more...
1 2 3 4
sum = 0 self.items.each { |item| sum += item.fragments.count } ...
Ruby Calculate sum of items in a...
I'm pretty sure I'm not doi...
1 2 3 4
class ItemsController < ApplicationController def create @product = Product.find(params[:product_id]) ...
Ruby Add product to cart, reject...
I've a simple cart applicat...
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...
What can be done to simplif...
1 2 3
if @user && @user.role && @user.role.eql?('user') && @user.user_group @group_name = @user.user_group.name end
Ruby Handling NoMethodError
It seems to me that there s...
1 2 3 4
// generate code for parsing an array of array tab = [ ["a","b"] , ["c","e"] , ["d"]] ...
Ruby Generate code for parsing a...
It's dirty but it's work...
1 2 3 4
# Array of LDAP group names @group_names = [] ...
Ruby Refactor array of hashes
The code below gives me wha...
1 2 3 4
def is_translated? if !params[:lang].blank? and params[:lang].eq?('en') return true ...
Ruby too many ifs and ands
there are too many if then ...
1 2 3 4
def include_class?(obj_class) stack = [] ...
Ruby hash.include_class?, recursive
I have a hash like this one...
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...
I've removed the code that ...
1 2 3 4
if @user.valid? .... result = create_customer ...
Ruby Redundant Else Clauses
Hi,
I have a controller wh...
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...
I have a method (LinkCatego...
1 2 3 4
require 'uri' require 'net/http' require 'net/https' ...
Ruby Ugly net/http code
I am not an expert of the n...
1 2 3 4
require 'ruby_camping' require 'camping_guests' ...
Ruby Help!! undefined method for...
Hi! Ive posted before about...
1 2 3 4
module Rack class SslBlock def initialize app, options = {} ...
Ruby Rack Middleware
any optimisations on this l...
What would be the best or a...