similar to: habtm recursion via destroy_without_callbacks

Displaying 20 results from an estimated 200 matches similar to: "habtm recursion via destroy_without_callbacks"

2006 Mar 23
2
rails 1.1 and mysql errors
Hi, I just upgraded to rails 1.1 this morning and i am getting a variety of errors from tests that were passing effortlessly on the previous edge release (i froze several weeks ago, so I not sure what version that was). Has anyone else experienced these types errors with the new rails: I have several errors that are grouped around create and destroy commands the errors are similar, first the
2007 Mar 29
21
a better "should have valid associations"
This is pretty much the same as last time around, if you recall. Thanks to Wilson for converting to the new form. I''ve added a few lines. Basically, it iterates over your model associations and does two things. - First, just try to call the association. Usually fixes speeling erors or other such silliness. - Second, try to find a record with an :include on the association. This
2006 Mar 29
0
Intermittent error - undefined method ''destroy_without_callbacks''
When testing my app locally I''m getting intermittent errors which are driving me mad! The error is: NameError ((eval):1:in `alias_method'': undefined method `destroy_without_callbacks'' for class `Exercise''): Refreshing the browser sometimes fixes it, as does restarting WEBrick. Annoying to debug as it only happens intermittently. Any ideas on why this is
2006 Jul 02
7
How can I intercept attribute calls?
Hi. I have two types of fields in my database, e.g. "name" and "name_ru". First one is a user''s name in english and the second one is in russian. I want to intercept calls like "c.name" and add "_ru" to it if current language is russian (I have my own Locale class like n Globalize). So I want such thing: -- Locale.set("en-US") c.name
2007 Nov 14
4
Interdependency between RSpec files
I run my suite of tests, one test fails. I run that one test file, no tests fail. Something is carrying over between files and I can''t figure out what. I tracked down the problem to the very line it''s occurring on, with printouts before and after every call to make sure I know exactly what is being reached. In this spec I have 0 fixtures/mocks/stubs. The objects in this
2006 Jul 19
1
Session management with SOAP and AWS
I''m working on a rails app where I''d like to have a session-based SOAP API. That is, I''d like to connect via SSL and have a ''login'' method followed by one or more other methods. I''m using the ActionWebService::Client::Soap class to connect to my app, but each method invocation results in a new session on the server (WEBrick, at the
2006 Jun 01
1
Automatted Getter/Setter
Hey.. So I have a model that has a lot of number fields. Each of these go through a process when read in and read out to add/remove commas (between every three numbers) to make them more readable. The getter I currently have is like this: def sale_price Listing.insert_commas(read_attribte (:sale_price)) end and the setter is: def sale_price=(price) write_attribute(:saleprice,
2007 Aug 30
1
alias_method_chain stack level too deep in Rake test only
I have an odd error. I have the following module: module ActionController module SslSupport def self.included(base) raise "#{base} does not define url_for" unless base.method_defined?(:url_for) unless base.respond_to?(:url_for_without_ssl_supprt) base.send :include, InstanceMethods base.send :alias_method_chain, :url_for, :ssl_support end
2007 Jan 02
4
allow stubbing of previously defined methods such as "id"
On my current project I needed to create a stub that responded correctly to the id message. Here''s the change I put into my copy of head. Index: lib/mocha/mock_methods.rb =================================================================== --- lib/mocha/mock_methods.rb (revision 1114) +++ lib/mocha/mock_methods.rb (working copy) @@ -68,6 +68,7 @@ method_names =
2007 Apr 06
3
Mailer method missing
Rails dies when I try to call a method from my Mailer. But I have defined my method. What could I have missed? Here is the irb session: >> p = Person.find(1) => Person data... >> SiteMailer.request_admin_approval(p) NoMethodError: undefined method `request_admin_approval'' for SiteMailer:Class >> SiteMailer.method_defined? :request_admin_approval => true The
2007 Mar 30
7
problem with using any_instance
Hey all, I have a question with using mocha in my tests. In the same test file, I have two tests, <code> def test_a klass.any_instance.stubs(:method_name).returns("something") klass.new.method_name ... end def test_b ... klass.new.method_name ... end </code> where klass is some class when the tests run, test _a passes, but test_b had an error like this:
2012 Feb 29
2
Export nls object to text file
Hi all, I am new to R and have some trouble with exporting results from a non linear squares object (.nls), would be very thankful if anyone could help me. So what I'm doing is a Bass modelling of some data. The result is stored in the object "Bass.nls". I want to export a matrix with the three columns: observation number, actual observation value, predicted observation value.
2007 Mar 12
10
using mocha with rspec
Hi folks. I''ve just started using rspec and I have to say it''s very nice. The thing is, I prefer mocha''s mocking dialect. So I thought a simple require ''mocha'' would set me up. Unfortunately, rspec does all its goodness using do/end blocks in anonymous classes, so it wasn''t quite that obvious. Anyway, here is the incantation I ended up
2008 Jun 05
2
how to add a method without coding it directly into app?
i''m missing something here. how would I code this outside the application to be shared with other Camping apps? module Blog::Controllers module AuthenticationHelper def self.included(base) class << base define_method :authenticate do |*a| a.each do |meth| if method_defined?(meth.to_s)
2006 Jul 27
9
Introspecting validates_presence_of
Hello people, I''d like to detect whether an attribute of a model has vaildates_presence_of applied to it so I can automatically apply a mandatory (*) to the field...it doesn''t look easy...any ideas? Cheers, -- Dan Webb http://www.danwebb.net
2006 Jan 19
2
Easy way to handle form input without a model class?
I have a couple forms that I''d like to be able to validate and automatically populate, but it shouldn''t be based on AR. In fact I often have a bunch of small forms that I can''t really justify writing a whole new model class for anyway. I''d like to validate the form input, and then use rails helpers to automatically populate the form if validations fail.
2008 Jun 03
8
@@state_secret
I was having some issue getting the class variables in Camping::Session to work with some old apps, so I''ve changed @@state_secret to a method. module Blog include Camping::Session def state_secret; "kxxxx" end end Also, merged some of zimbatm''s patches. And trying to revive the Junebug wiki <http://github.com/why/junebug> since it''s still
2006 Jun 15
4
parse only seem to understand US date format
I''ve tried Time.parse() and DateTime.parse() but they interpret the date as US format. Is there any way to tell it to interpret as dd/mm/yyyy? -- Posted via http://www.ruby-forum.com/.
2006 Jun 20
1
Possible to check if form field is required?
Hi list, is it possible to check if form field will be required when form is submitted (through validates_presence_of or some other validates_* method)? I could do this manually but it doesn''t seems to me very DRY. For example, I would like to be able to dynamically add asterisk with some helper method if city is required here: City*: <%= text_field
2005 Dec 16
2
Using logger from rails cron jobs
Hi. I''m trying to use logger from a rails cron job. It works fine, but I''d like the standard ruby behavior of stamping each log with date and time. How do I do this? I''m trying: # Set up out logging require ''logger'' logger = Logger.new(STDERR) logger.level = Logger::INFO RAILS_DEFAULT_LOGGER = logger # Tell rails to log to our logger also The