search for: reverse_merge

Displaying 10 results from an estimated 10 matches for "reverse_merge".

2010 Mar 24
2
Mock "Consent_6335" received unexpected message :marked_for_destruction? with (no args)
I have a mock object (Person) that is associated with another object (my_object) through a belongs_to association. When I check whether my_object is valid (my_object.should be_valid), I am getting an error like the following: Mock "Person_6338" received unexpected message :marked_for_destruction? with (no args) Checking the list of methods on the mock,
2009 Feb 09
3
can't call request.remote_ip from object?
class User def update_metadata self.update_attributes({:last_login_at => Time.now, :last_known_up => request.remote_ip, :last_known_user_agent => request.user_agent}) end This does not work. It bombs out with: undefined local variable or method `request'' for #<User:0x1e146e0> But the request calls work in a
2006 Jul 31
2
is it possible to make to_xml use underscore instead of dash?
Hi all, I am getting ActiveRecord to produce XML with render :xml => @user.to_xml However, on the client end it is a bit annoying for me to deal with attributes like first-name. I would much rather have first_name. Is there any way for me to turn off the behavior of converting _ to -? This seems to be done by a call to dasherize inside the to_xml of
2005 Nov 10
6
Manually loading fixture data
Hi all, I''ve got some tables with fixed amounts of data in them (a "states" table, for example). For tables like this I can easily put *all* of the data in the fixture. For general futzing purposes, and for those times I want to reload a database from scratch outside of testing (for whatever reason), what''s the best approach? I thought perhaps ActiveRecord::Base had
2006 Apr 11
0
Getting error while running typo......
...ough browser I am getting following error:- ================================== ./script/../config/..//vendor/rails/activesupport/lib/active_support/core_ext/hash.rb:3:in `require'': No such file to load -- ./script/../config/..//vendor/rails/activesupport/lib/active_support/core_ext/hash/reverse_merge (LoadError) from ./script/../config/..//vendor/rails/activesupport/lib/active_support/core_ext/hash.rb:3 from ./script/../config/..//vendor/rails/activesupport/lib/active_support/core_ext.rb:1:in `require'' from ./script/../config/..//vendor/rails/activesupport/lib/active_support/co...
2008 Jun 14
0
does BackgrounDRB not "know" the rails environment it is running within/in parallel with?]
...quot;w+") do |f| f.puts( htmlstring) f.close end true end The self.render_to_string does look like this # Renders a record instance to a string using the provided template and additional variables. def render_to_string(template, variables={}) assigns = variables.reverse_merge(self.class.class_name.underscore.to_sym => self) self.class.render_string(template, assigns) end and the self.class.render_string looks like this # Renders a template to a string with the included variable assignments def self.render_string(template, assigns) viewer = Clas...
2010 Feb 18
5
Converting hash to option string
Is there a good way to programmatically convert {:a=>''b'', :c=>''d''} to ''a=b c=d'' ? Rails seems to do this knid of thing "all over the place". I see reverse_merge and similar functions ... but I wonder if this is canned behavior somewhere. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA3...
2006 Mar 14
7
Overriding new or create for a model
I have a model where I need to calculate one of the fields when I create a new instance. It seems to me that I should do this in the model code and that I should override the new and/or create methods. Is this the right approach and, if so, how can I execute the existing method but add on my calculation? I want something like: def create -Do the original create first- field =
2007 Jan 11
12
Rails not properly handling Oracle db connections/sesions in dev mode
We are running edge rails with oracle. After a few hundred requests all available sesions are used up. It seems prior connections are being left open. When this happens no one using the installation of Oracle can create a new session until you kill your mongrel/webrick server. Patch #6928 addresses this problem, and i applied it to my vendor rails and it worked. I think, if possible, this
2006 Jul 24
7
[PATCH] Support for DB Clusters/Replication in ActiveRecord (RFC)
...ction. + conn.verify!(@@verification_timeout) + elsif spec = @@defined_connections[id] + # Activate this connection specification. + # Note this no longer calls connection= which causes problems + # with read/write pools being clobbered. + config = spec.config.reverse_merge(:allow_concurrency => @@allow_concurrency) + active_connections[id] = self.send(spec.adapter_method, config) + conn = active_connections[id] + end conn or raise ConnectionNotEstablished end # Returns true if a connection that''s accessible to this...