Skip to content

Instantly share code, notes, and snippets.

@dtolj
Created June 1, 2012 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtolj/2853246 to your computer and use it in GitHub Desktop.
Save dtolj/2853246 to your computer and use it in GitHub Desktop.
Active Record query
Started GET "/dashboard/" for 127.0.0.1 at 2012-06-01 12:30:45 -0400
Processing by DashboardController#index as HTML
Completed 500 Internal Server Error in 1ms
ArgumentError (wrong number of arguments (3 for 2)):
app/controllers/dashboard_controller.rb:34:in `index'
Rendered /usr/local/rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (5.5ms)
Rendered /usr/local/rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.3ms)
Rendered /usr/local/rvm/gems/ruby-1.9.2-p0/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (16.4ms)
------
#database.yaml
development:
adapter: informix
server: server
database: dbname
username: user
password: pass
#model
class Client < ActiveRecord::Base
establish_connection 'development'
self.table_name = 'resource'
self.primary_key = 'resourceid'
end
#Controller
#doesn't work!
@client=Client.find(10)
#works
@client=Client.connection.select_all("select * from resource where resourceid=10")
#View
def index
=@client.inspect
end
ERROR:
wrong number of arguments (3 for 2) on line @client=Client.find(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment