Hi, all, now with AR-4 is imposible to add any relation
I mean for example:
Blog.entries.new
And you'll have a very weird erro. Do not happen the same thing when you do
it in the console.
NO ONE application, work the Table.relation.new or Table.relation.create...
except in the console...
Could we move to datamapper???
ArgumentError at /estacion/pacientes/evolucionar/1
wrong number of arguments (1 for 2)
Ruby <main>: in initialize, line 27
Web POST localhost/estacion/pacientes/evolucionar/1
Jump to:
* GET
* POST
* Cookies
* ENV
Traceback (innermost first)
* <main>: in initialize
*
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/inheritance.rb:
in new
20. end
21. if (attrs = args.first).is_a?(Hash)
22. if subclass = subclass_from_attrs(attrs)
23. return subclass.new(*args, &block)
24. end
25. end
26. # Delegate to the original .new
27. super...
28. end
29.
30. # True if this isn't a concrete subclass needing a STI type condition.
31. def descends_from_active_record?
32. if self == Base
33. false
34. elsif superclass.abstract_class?
*
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/inheritance.rb:
in new
20. end
21. if (attrs = args.first).is_a?(Hash)
22. if subclass = subclass_from_attrs(attrs)
23. return subclass.new(*args, &block)
24. end
25. end
26. # Delegate to the original .new
27. super...
28. end
29.
30. # True if this isn't a concrete subclass needing a STI type condition.
31. def descends_from_active_record?
32. if self == Base
33. false
34. elsif superclass.abstract_class?
*
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/reflection.rb:
in build_association
182. super
183. @collection = [:has_many, :has_and_belongs_to_many].include?(macro)
184. end
185.
186. # Returns a new, unsaved instance of the associated class.
+attributes+ will
187. # be passed to the class's constructor.
188. def build_association(attributes, &block)
189. klass.new(attributes, &block)...
190. end
191.
192. def table_name
193. @table_name ||= klass.table_name
194. end
195.
196. def quoted_table_name
*
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/associations/association.rb:
in build_record
235. # the target is stale.
236. #
237. # This is only relevant to certain associations, which is why it
returns nil by default.
238. def stale_state
239. end
240.
241. def build_record(attributes)
242. reflection.build_association(attributes) do |record|...
243. initialize_attributes(record)
244. end
245. end
246. end
247. end
248. end
*
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/associations/collection_association.rb:
in build
107. first_or_last(:last, *args)
108. end
109.
110. def build(attributes = {}, &block)
111. if attributes.is_a?(Array)
112. attributes.collect { |attr| build(attr, &block) }
113. else
114. add_to_target(build_record(attributes)) do |record|...
115. yield(record) if block_given?
116. end
117. end
118. end
119.
120. def create(attributes = {}, &block)
121. create_record(attributes, &block)
*
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/associations/collection_proxy.rb:
in build
222. # # #<Pet id: nil, name: "Choo-Choo", person_id: 1>,
223. # # #<Pet id: nil, name: "Brain", person_id: 1>
224. # # ]
225. #
226. # person.pets.size # => 5 # size of the collection
227. # person.pets.count # => 0 # count from database
228. def build(attributes = {}, &block)
229. @association.build(attributes, &block)...
230. end
231. alias_method :new, :build
232.
233. # Returns a new object of the collection type that has been
instantiated with
234. # attributes, linked to this object and that has already been saved
(if it
235. # passes the validations).
236. #
* hermes.rb: in post
1098. # el paciente viene del parametro dado
1099. @paciente=Paciente.find_by_cama paciente
1100.
1101. # validamos que este listo para evolucionar
1102. @fiebre=input.include? 'fiebre'
1103.
1104. # creamos el paciente nuevo
1105. @[email protected]
:evolucion=>input.evolucion.to_s, :fiebre=>@fiebre,:senho=>@state[:realname]...
1106.
1107. @evolucion.save # muestrame como quedo
1108. redirect R(EstacionPacientesN,paciente)
1109.
1110. end # if
1111.
1112. end # post
* <main>: in block in service
* <main>: in catch
* <main>: in service
* <main>: in call
*
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:
in call
218.
219. def call(env)
220. context(env)
221. end
222.
223. def context(env, app=@app)
224. prepare_session(env)
225. status, headers, body = app.call(env)...
226. commit_session(env, status, headers, body)
227. end
228.
229. private
230.
231. def initialize_sid
232. @sidbits = @default_options[:sidbits]
*
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:
in context
218.
219. def call(env)
220. context(env)
221. end
222.
223. def context(env, app=@app)
224. prepare_session(env)
225. status, headers, body = app.call(env)...
226. commit_session(env, status, headers, body)
227. end
228.
229. private
230.
231. def initialize_sid
232. @sidbits = @default_options[:sidbits]
*
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:
in call
213. @default_options = self.class::DEFAULT_OPTIONS.merge(options)
214. @key = @default_options.delete(:key)
215. @cookie_only = @default_options.delete(:cookie_only)
216. initialize_sid
217. end
218.
219. def call(env)
220. context(env)...
221. end
222.
223. def context(env, app=@app)
224. prepare_session(env)
225. status, headers, body = app.call(env)
226. commit_session(env, status, headers, body)
227. end
* <main>: in block in use
* (eval): in call
* (eval): in call
* <main>: in block in use
* /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1.532/lib/camping/server.rb:
in call
159. if key = apps.keys.grep(/^#{@reloader.name}$/i)[0]
160. apps[key]
161. end
162. end
163.
164. def call(env)
165. app = current_app || raise("Could not find an app called
`#{@reloader.name}`")
166. app.call(env)...
167. end
168.
169. class XSendfile
170. def initialize(app)
171. @app = app
172. end
173.
* /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/cascade.rb: in
block in call
26. # by the server, or if it is replaced by a middleware action. Cascade
27. # replaces the body each time a cascade happens. It is assumed that nil
28. # does not respond to close, otherwise the previous application body
29. # will be closed. The final application body will not be closed, as it
30. # will be passed to the server as a result.
31. last_body.close if last_body.respond_to? :close
32.
33. result = app.call(env)...
34. last_body = result[2]
35. break unless @catch.include?(result[0].to_i)
36. end
37.
38. result
39. end
40.
* /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/cascade.rb: in each
17. end
18.
19. def call(env)
20. result = NotFound
21.
22. last_body = nil
23.
24. @apps.each do |app|...
25. # The SPEC says that the body must be closed after it has been iterated
26. # by the server, or if it is replaced by a middleware action. Cascade
27. # replaces the body each time a cascade happens. It is assumed that nil
28. # does not respond to close, otherwise the previous application body
29. # will be closed. The final application body will not be closed, as it
30. # will be passed to the server as a result.
31. last_body.close if last_body.respond_to? :close
* /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/cascade.rb: in call
17. end
18.
19. def call(env)
20. result = NotFound
21.
22. last_body = nil
23.
24. @apps.each do |app|...
25. # The SPEC says that the body must be closed after it has been iterated
26. # by the server, or if it is replaced by a middleware action. Cascade
27. # replaces the body each time a cascade happens. It is assumed that nil
28. # does not respond to close, otherwise the previous application body
29. # will be closed. The final application body will not be closed, as it
30. # will be passed to the server as a result.
31. last_body.close if last_body.respond_to? :close
* /usr/local/lib/ruby/gems/1.9.1/gems/camping-2.1.532/lib/camping/server.rb:
in call
168.
169. class XSendfile
170. def initialize(app)
171. @app = app
172. end
173.
174. def call(env)
175. status, headers, body = @app.call(env)...
176.
177. if key = headers.keys.grep(/X-Sendfile/i).first
178. filename = headers[key]
179. content = open(filename,'rb') { | io | io.read}
180. headers['Content-Length'] = size(content).to_s
181. body = [content]
182. end
* /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/lint.rb: in _call
42. assert("No env given") { env }
43. check_env env
44.
45. env['rack.input'] = InputWrapper.new(env['rack.input'])
46. env['rack.errors'] = ErrorWrapper.new(env['rack.errors'])
47.
48. ## and returns an Array of exactly three values:
49. status, headers, @body = @app.call(env)...
50. ## The *status*,
51. check_status status
52. ## the *headers*,
53. check_headers headers
54.
55. check_hijack_response headers, env
56.
* /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/lint.rb: in call
30. ## after to catch all mistakes.
31.
32. ## = Rack applications
33.
34. ## A Rack application is a Ruby object (not a class) that
35. ## responds to +call+.
36. def call(env=nil)
37. dup._call(env)...
38. end
39.
40. def _call(env)
41. ## It takes exactly one argument, the *environment*
42. assert("No env given") { env }
43. check_env env
44.
* /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/showexceptions.rb:
in call
17.
18. def initialize(app)
19. @app = app
20. @template = ERB.new(TEMPLATE)
21. end
22.
23. def call(env)
24. @app.call(env)...
25. rescue StandardError, LoadError, SyntaxError => e
26. exception_string = dump_exception(e)
27.
28. env["rack.errors"].puts(exception_string)
29. env["rack.errors"].flush
30.
31. if prefers_plain_text?(env)
* /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/commonlogger.rb: in
call
26. def initialize(app, logger=nil)
27. @app = app
28. @logger = logger
29. end
30.
31. def call(env)
32. began_at = Time.now
33. status, header, body = @app.call(env)...
34. header = Utils::HeaderHash.new(header)
35. body = BodyProxy.new(body) { log(env, status, header, began_at) }
36. [status, header, body]
37. end
38.
39. private
40.
* /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/chunked.rb: in call
36. end
37.
38. def initialize(app)
39. @app = app
40. end
41.
42. def call(env)
43. status, headers, body = @app.call(env)...
44. headers = HeaderHash.new(headers)
45.
46. if env['HTTP_VERSION'] == 'HTTP/1.0' ||
47. STATUS_WITH_NO_ENTITY_BODY.include?(status) ||
48. headers['Content-Length'] ||
49. headers['Transfer-Encoding']
50. [status, headers, body]
* /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/content_length.rb:
in call
7. include Rack::Utils
8.
9. def initialize(app)
10. @app = app
11. end
12.
13. def call(env)
14. status, headers, body = @app.call(env)...
15. headers = HeaderHash.new(headers)
16.
17. if !STATUS_WITH_NO_ENTITY_BODY.include?(status.to_i) &&
18. !headers['Content-Length'] &&
19. !headers['Transfer-Encoding'] &&
20. body.respond_to?(:to_ary)
21.
* /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/handler/webrick.rb:
in service
53. env["QUERY_STRING"] ||= ""
54. unless env["PATH_INFO"] == ""
55. path, n = req.request_uri.path, env["SCRIPT_NAME"].length
56. env["PATH_INFO"] = path[n, path.length-n]
57. end
58. env["REQUEST_PATH"] ||= [env["SCRIPT_NAME"], env["PATH_INFO"]].join
59.
60. status, headers, body = @app.call(env)...
61. begin
62. res.status = status.to_i
63. headers.each { |k, vs|
64. if k.downcase == "set-cookie"
65. res.cookies.concat vs.split("\n")
66. else
67. # Since WEBrick won't accept repeated headers,
* /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb: in service
131.
132. servlet, options, script_name, path_info = search_servlet(req.path)
133. raise HTTPStatus::NotFound, "`#{req.path}' not found." unless servlet
134. req.script_name = script_name
135. req.path_info = path_info
136. si = servlet.get_instance(self, *options)
137. @logger.debug(format("%s is invoked.", si.class.name))
138. si.service(req, res)...
139. end
140.
141. def do_OPTIONS(req, res)
142. res["allow"] = "GET,HEAD,POST,OPTIONS"
143. end
144.
145. ##
* /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb: in run
87. if callback = server[:RequestCallback]
88. callback.call(req, res)
89. elsif callback = server[:RequestHandler]
90. msg = ":RequestHandler is deprecated, please use :RequestCallback"
91. @logger.warn(msg)
92. callback.call(req, res)
93. end
94. server.service(req, res)...
95. rescue HTTPStatus::EOFError, HTTPStatus::RequestTimeout => ex
96. res.set_error(ex)
97. rescue HTTPStatus::Error => ex
98. @logger.error(ex.message)
99. res.set_error(ex)
100. rescue HTTPStatus::Status => ex
101. res.status = ex.code
* /usr/local/lib/ruby/1.9.1/webrick/server.rb: in block in start_thread
184. addr = sock.peeraddr
185. @logger.debug "accept: #{addr[3]}:#{addr[1]}"
186. rescue SocketError
187. @logger.debug "accept: <address unknown>"
188. raise
189. end
190. call_callback(:AcceptCallback, sock)
191. block ? block.call(sock) : run(sock)...
192. rescue Errno::ENOTCONN
193. @logger.debug "Errno::ENOTCONN raised"
194. rescue ServerError => ex
195. msg = "#{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}"
196. @logger.error msg
197. rescue Exception => ex
198. @logger.error ex
Request information
GET
No GET data.
POST
Variable Value
evolucion "esto es una evolucion de ejemplo\r\n"
fiebre "No tiene Fiebre"
COOKIES
Variable Value
"BAh7B0kiD3Nlc3Npb25faWQGOgZFRiJFNDMyZTY4MmNhY2YzOWQ4MGY5ZGZi\
nNTk3NWM0YTY3N2Q5OGMxNmQ3MWFjMzkwOWNiMzFiOGJhMDQ1YTM1ZjU5OUki\
hermes.state nDGNhbXBpbmcGOwBGews6CWF1dGhUOgl1c2VySSIKbnVyc2UGOwBUOg11c2Vy\
nbmFtZUAKOg1yZWFsbmFtZUkiGkZsb3JlbmNlIE5pZ3RodGluZ2FsZQY7AFQ6\
nDWVzdGFjaW9uSSIUL2VzdGFjaW9uL251cnNlBjoNZW5jb2RpbmciEElTTy04\nODU5LTE1OgplbWFpbEkiFWxhemFyb0Bsb2NhbGhvc3QGOwBU\
n--10d7b651e46bb5ea8946449f2908aded3c946e42"
Rack ENV
Variable
Value
CONTENT_LENGTH 71
CONTENT_TYPE application/x-www-form-urlencoded
GATEWAY_INTERFACE CGI/1.1
HTTP_ACCEPT text/html, text/*;q=0.5, image/*,
application/*, audio/*, video/*, message/*
HTTP_ACCEPT_ENCODING gzip, compress, bzip, bzip2, deflate
HTTP_ACCEPT_LANGUAGE en;q=1.0
HTTP_COOKIE hermes.state=
BAh7B0kiD3Nlc3Npb25faWQGOgZFRiJFNDMyZTY4MmNhY2YzOWQ4MGY5ZGZi%0ANTk3NWM0YTY3N2Q5OGMxNmQ3MWFjMzkwOWNiMzFiOGJhMDQ1YTM1ZjU5OUki%0ADGNhbXBpbmcGOwBGews6CWF1dGhUOgl1c2VySSIKbnVyc2UGOwBUOg11c2Vy%0AbmFtZUAKOg1yZWFsbmFtZUkiGkZsb3JlbmNlIE5pZ3RodGluZ2FsZQY7AFQ6%0ADWVzdGFjaW9uSSIUL2VzdGFjaW9uL251cnNlBjoNZW5jb2RpbmciEElTTy04%0AODU5LTE1OgplbWFpbEkiFWxhemFyb0Bsb2NhbGhvc3QGOwBU%0A--10d7b651e46bb5ea8946449f2908aded3c946e42
HTTP_COOKIE2 $Version="1"
HTTP_HOST localhost:3301
HTTP_REFERER
http://localhost:3301/estacion/pacientes/evolucionar/1
HTTP_USER_AGENT w3m/0.5.3+cvs-1.1055
HTTP_VERSION HTTP/1.1
PATH_INFO /estacion/pacientes/evolucionar/1
QUERY_STRING
REMOTE_ADDR 127.0.0.1
REMOTE_HOST 127.0.0.1
REQUEST_METHOD POST
REQUEST_PATH /estacion/pacientes/evolucionar/1
REQUEST_URI
http://localhost:3301/estacion/pacientes/evolucionar/1
SCRIPT_NAME
SERVER_NAME localhost
SERVER_PORT 3301
SERVER_PROTOCOL HTTP/1.1
SERVER_SOFTWARE WEBrick/1.3.1 (Ruby/1.9.3/2013-02-06)
:input
rack.errors #<Rack::Lint::ErrorWrapper:0xa564a8c
@error=#<IO:<STDERR>>>
rack.input #<Rack::Lint::InputWrapper:0xa564adc
@input=#<StringIO:0xa5fe560>>
rack.multiprocess false
rack.multithread true
{"hermes.state"=>"BAh7B0kiD3Nlc3Npb25faWQGOgZFRiJFNDMyZTY4MmNhY2YzOWQ4MGY5ZGZi\
rack.request.cookie_hash
nNTk3NWM0YTY3N2Q5OGMxNmQ3MWFjMzkwOWNiMzFiOGJhMDQ1YTM1ZjU5OUki\nDGNhbXBpbmcGOwBGews6CWF1dGhUOgl1c2VySSIKbnVyc2UGOwBUOg11c2Vy\
nbmFtZUAKOg1yZWFsbmFtZUkiGkZsb3JlbmNlIE5pZ3RodGluZ2FsZQY7AFQ6\nDWVzdGFjaW9uSSIUL2VzdGFjaW9uL251cnNlBjoNZW5jb2RpbmciEElTTy04\
nODU5LTE1OgplbWFpbEkiFWxhemFyb0Bsb2NhbGhvc3QGOwBU\n--10d7b651e46bb5ea8946449f2908aded3c946e42"}
rack.request.cookie_string hermes.state=
BAh7B0kiD3Nlc3Npb25faWQGOgZFRiJFNDMyZTY4MmNhY2YzOWQ4MGY5ZGZi%0ANTk3NWM0YTY3N2Q5OGMxNmQ3MWFjMzkwOWNiMzFiOGJhMDQ1YTM1ZjU5OUki%0ADGNhbXBpbmcGOwBGews6CWF1dGhUOgl1c2VySSIKbnVyc2UGOwBUOg11c2Vy%0AbmFtZUAKOg1yZWFsbmFtZUkiGkZsb3JlbmNlIE5pZ3RodGluZ2FsZQY7AFQ6%0ADWVzdGFjaW9uSSIUL2VzdGFjaW9uL251cnNlBjoNZW5jb2RpbmciEElTTy04%0AODU5LTE1OgplbWFpbEkiFWxhemFyb0Bsb2NhbGhvc3QGOwBU%0A--10d7b651e46bb5ea8946449f2908aded3c946e42
rack.request.form_hash {"fiebre"=>"No tiene Fiebre",
"evolucion"=>"esto es una evolucion de ejemplo\r\n"}
rack.request.form_input #<Rack::Lint::InputWrapper:0xa564adc
@input=#<StringIO:0xa5fe560>>
rack.request.form_vars
fiebre=No+tiene+Fiebre&evolucion=esto+es+una+evolucion+de+ejemplo%0D%0A
rack.request.query_hash {}
rack.request.query_string
rack.run_once false
rack.session
{"session_id"=>"432e682cacf39d80f9dfb5975c4a677d98c16d71ac3909cb31b8ba045a35f599",
"camping"=>{:auth=>true, :user=>"nurse",
:username=>"nurse", :realname=>"Florence
Nigthtingale", :estacion=>"/estacion/nurse", :email=>"lazaro@localhost"}}
rack.session.options {:path=>"/", :domain=>nil,
:expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false,
:renew=>false, :sidbits=>128,
:secure_random=>SecureRandom,
:secret=>"*Dorothy+Ogrem!",
:coder=>#<Rack::Session::Cookie::Base64::Marshal:0xa395620>}
rack.session.unpacked_cookie_data
{"session_id"=>"432e682cacf39d80f9dfb5975c4a677d98c16d71ac3909cb31b8ba045a35f599",
"camping"=>{:auth=>true, :user=>"nurse",
:username=>"nurse", :realname=>"Florence
Nigthtingale", :estacion=>"/estacion/nurse", :email=>"lazaro@localhost"}}
rack.url_scheme http
rack.version [1, 2]
You're seeing this error because you use Rack::ShowExceptions.
_______________________________________________
Camping-list mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/camping-list