Skip to content

Instantly share code, notes, and snippets.

lite@lite-debian:~$ irb
ruby-1.9.2-p0 > class C; end
=> nil
ruby-1.9.2-p0 > c = C.new
=> #<C:0x00000000becdf0>
ruby-1.9.2-p0 > c.method
ArgumentError: wrong number of arguments(0 for 1)
from (irb):3:in `method'
from (irb):3
from /home/lite/.rvm/rubies/ruby-1.9.2-p0/bin/irb:16:in `<main>'
# ActiveRecord::ConnectionAdapters::Mysql2IndexDefinition
module ActiveRecord
module ConnectionAdapters
class Mysql2IndexDefinition
def case_sensitive?
false
end
end
end
# File net/pop.rb, line 410
def initialize(addr, port = nil, isapop = false)
@address = addr
@ssl_params = POP3.ssl_params
@port = port
@apop = isapop
@command = nil
@socket = nil
@started = false
dd780fc2 (johan pretorius 2010-10-04 12:13:12 +0200 148) if (admin? or current_user.tf_admin?) and @channel_user
4315fa78 (johan pretorius 2010-01-24 20:00:54 +0200 149) redirect_to :controller => :channel_users, :action => 'index'
dd780fc2 (johan pretorius 2010-10-04 12:13:12 +0200 150) elsif (admin? or current_user.tf_admin?)
dd780fc2 (johan pretorius 2010-10-04 12:13:12 +0200 151) redirect_to :controller => :accounts, :action => 'show'
bea746b9 (Johannes Fahrenkrug 2009-03-27 16:39:08 +0100 152) else
bea746b9 (Johannes Fahrenkrug 2009-03-27 16:39:08 +0100 153) redirect_to :action => 'edit', :id => @user.id
bea746b9 (Johannes Fahrenkrug 2009-03-27 16:39:08 +0100 154) end
bea746b9 (Johannes Fahrenkrug 2009-03-27 16:39:08 +0100 155) else
bea746b9 (Johannes Fahrenkrug 2009-03-27 16:39:08 +0100 156) render :action => 'edit'
FIELDS = [:about_url, :feedback_url, :terms_of_service_url, :privacy_policy_url, :support_url, :contact_url]
self.with_options(:with => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix ) do |url|
FIELDS.each do |field|
url.validates_format_of field, :if => lambda{ |val| !val.send(field).blank? }
end
end
<% f.with_options :class => "rounded_field" do |opt| %>
<%= opt.text_field :twitter_api %>
<br /> <br />
<%= opt.text_field :facebook_api %>
<br /> <br />
<%= opt.text_field :feedback_url %>
<% end %>
NoMethodError: undefined method `length' for nil:NilClass
from /opt/rails/tweetscreener/releases/20101117090454/app/models/post.rb:111:in `body_length'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:178:in `send'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:178:in `evaluate_method'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:166:in `call'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:90:in `run'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:90:in `each'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:90:in `send'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:90:in `run'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:276:in `run_callbacks'
# -*- encoding: utf-8 -*-
module Textual
def to_ascii
foo = self.downcase.strip
foo.gsub!(/[ĄÀ�?ÂÃâäàãáäå�?ăąǎǟǡǻ�?ȃȧẵặ]/,'a')
foo.gsub!(/[Ęëêéèẽēĕėẻȅȇẹȩęḙḛ�?ếễểḕḗệ�?]/,'e')
foo.gsub!(/[Ì�?ÎĨ�?iìíîĩīĭïỉ�?ịįȉȋḭɨḯ]/,'i')
foo.gsub!(/[ÒÓÔÕÖòóôõ�?�?ȯö�?őǒ�?�?ơǫ�?ɵøồốỗổȱȫȭ�?�?ṑṓ�?ớỡởợǭộǿ]/,'o')
module ActiveRecord
module ConnectionAdapters
class Mysql2Adapter
def truncate_table(table_name)
execute("TRUNCATE TABLE #{quote_table_name(table_name)};")
end
end
end
end
@pages = Page.paginate :page => params[:page],
:order => 'created_at DESC',
:conditions => ['user_profile_id = ?', nil]