similar to: Overriding default ActiveRecord behaviour

Displaying 20 results from an estimated 20000 matches similar to: "Overriding default ActiveRecord behaviour"

2006 May 26
1
Overriding default type mappings of ActiveRecord
Hi: Is there a good way to override the mappings between class variables and database column type as determined by activerecord ? I have a column in the database table (postgres) that is declared as numeric(1000,0) which is an exact precision type. However, activerecord maps the correspoding class variable to type float which will not work for me. I''d like to map it to ruby type Bignum
2007 Oct 12
3
Strange mock_model behaviour with ActiveResource model
Hi, I have two models in an app that inherit from ActiveResource::Base. The scaffold controller tests for one of the models works fine, but the other one dies when calling mock_model in the "handling GET /fa_codes" spec: Specifically, the call to mock model here: before do @fa_code = mock_model(FaCode) FaCode.stub!(:find).and_return([@fa_code]) end generates this failure:
2006 Jul 18
1
Saving an ActiveRecord object
I get this error when I try to save an object that extends of ActiveRecord: NoMethodError in TeamController#add_player You have a nil object when you didn''t expect it! The error occured while evaluating nil.keys .... .... #{RAILS_ROOT}/app/models/player.rb:17:in `create_player'' #{RAILS_ROOT}/app/controllers/team_controller.rb:53:in `add_player'' And my Player model
2012 May 01
5
RHEL 6 and ActiveRecord issues
All, I am trying to install puppet master version 2.7.13 on Red Hat Enterprise Linux 6, and utilize stored configs. I followed the guide here: http://projects.puppetlabs.com/projects/1/wiki/Using_Stored_Configuration When I run puppet --noop on one of the clients, I get the following error: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload
2011 Apr 30
1
Could not autoload inventory_active_record: uninitialized constant ActiveRecord
Trying to set up the inventory service on puppet 2.6.8, pretty sure I''ve met all the dependencies but puppetmaster logs Could not autoload inventory_active_record: uninitialized constant ActiveRecord When clients attempt to connect. local gems: *** LOCAL GEMS *** abstract (1.0.0) actionmailer (3.0.7, 2.2.3) actionpack (3.0.7, 2.2.3) activemodel (3.0.7) activerecord (3.0.7)
2009 Mar 11
6
Monkey Patching a Plugin
I am using a plugin that adds a method to ActiveRecord::Base. The added method is called self.create_or_update. I need to monkey patch this method. I tried in lib/ config/initializers and in environment.rb, but the one in the plugin is always the one that is run. Where do I put my version of the method so that it overrides that of the plugin? I only use this method when running a rake task, so
2006 Jan 17
0
Overriding Delete/Destroy in ActiveRecord
Anybody know how I can override delete/destroy in objects that have has_and_belongs_to_many behavior specified? I''m having issues overriding delete for an ActiveRecord object that contains a has_and_belongs_to_many relationship. Delete and destroy are properly overridden for objects that do not have has_and_belongs_to_many relationships specified, but as soon as I add any the overridden
2007 Jan 10
3
ActiveRecord Error?
We spent a big chunk of yesterday hunting down a strange bug in one of our rails apps and created a test project to try out different theories on what was going on. The result so far is a very small test case app that perfectly reproduces the problem. The question is, is there anything *wrong* with what we''re doing here, or is it a problem with ActiveRecord? We''re on rails
2003 Feb 06
1
Strange "username map" behaviour with "security=user"
I use Samba 2.2.0 on small network. I use "security = user" and "username map" to map some Win-users to unix users. I have simple testing file with username mapping: root = vlad It is supposed that when I connect to samba as user "Vlad" with vlad's password I get the root's rigths to shares. Right? But when I try to connect to samba as "vlad"
2007 Mar 17
4
Created_on and updated_on in a non-ActiveRecord model
Hi you all, I have a model simulating an ActiveRecord model, according to the tips stated in [1]. It is simulated because even though I am gonna save the attributes in a file, not in a DB, I still want the validations made by ActiveRecord::Base (see code below). Well, the thing is that I also want the behaviour of the created_on and updated_on columns, that get modified automatically before
2006 Sep 01
2
Include ActiveResource
Hello, I want to give ActiveResource a spin. I have all the code checked out from SVN in vendor/rails (yes, including ActiveResource). I''m trying to make sure it gets loaded. I did this in environment.rb: config.load_paths += %W( #{RAILS_ROOT}/vendor/rails/activeresource/lib ) Unfortunately I still can''t use it. I have an ActiveResource derived model, Address: class
2006 Sep 01
2
Uninitialized constant w/ ActiveResource
Howdy, I had an application perfect for ActiveResource, which I do realize is not finished. Anyway, I froze my app to edge and then defined a class: class Address < ActiveResource::Base self.site = "http://ws.geonames.org/findNearestAddress?lat=:lat&lng=:long" End I tried to use it from the console but I get the trace below. It appears it can''t
2007 Feb 07
5
Mocking ActiveResource
I want to use ActiveResource in my app. Instead of hitting server though, I want it to load from a file when I call find. Any clue how I do that? Pat
2013 Jan 08
3
[SEC] Rails 3.2.11, 3.1.10, 3.0.19, and 2.3.15 have been released!
Hi everybody. I''d like to announce that 3.2.11, 3.1.10, 3.0.19, and 2.3.15 have been released. These releases contain two **extremely critical security fixes** so please update **IMMEDIATELY**. You can read about the security fixes by following these links: * [CVE-2013-0155](https://groups.google.com/group/rubyonrails-security/browse_thread/thread/b75585bae4326af2) *
2013 Jan 08
3
[SEC] Rails 3.2.11, 3.1.10, 3.0.19, and 2.3.15 have been released!
Hi everybody. I''d like to announce that 3.2.11, 3.1.10, 3.0.19, and 2.3.15 have been released. These releases contain two **extremely critical security fixes** so please update **IMMEDIATELY**. You can read about the security fixes by following these links: * [CVE-2013-0155](https://groups.google.com/group/rubyonrails-security/browse_thread/thread/b75585bae4326af2) *
2006 Jul 06
6
Help with overriding / overwriting date values in ActiveRecord to accept Euro Style Date from a Textbox
Hi guys, I''m trying to make an AR model which accepts a string data (from a text input) in euro date format eg <input .... value = "23/01/2006"> ( 23 Jan 2006) Reading the example from RDoc... i tried to overwrite/overload/override the = function to write in the date.. Cant get it to work because .. i dont knoe what format should it accept.. i''ve tried
2008 Jun 02
3
Undefined method `store_full_sti_class=' for ActiveRecord::Base:Class (NoMethodError)
Hi everyone, I created a new demo app with ''rails demo'' and proceeded to try and launch the server with ''ruby scripts/server''. I get the following stack: C:\railsProj\demo>ruby script/server => Booting Mongrel (use ''script/server webrick'' to force WEBrick) => Rails application starting on http://0.0.0.0:3000 => Call with -d to
2006 Jan 20
3
Is there a way to validate a model w/o saving it?
I have some code in my controller which looks like this: if request.post? and @account.save and @user.save ... end and in my Account and User models I have many :validates, like so account.rb validates_presence_of :subdomain, :on => :create validates_uniqueness_of :subdomain, :on => :create, :message => "is already being used" validates_exclusion_of
2009 Oct 28
2
What's the simplest way to use ActiveResource in ruby (without rails)?
I would like to use this class in a standalone project, but I have been unsuccessful thus far. Also, how does this class exactly communicate with the web server? Thank you. class Person < ActiveResource::Base self.site = "http://localhost:3000/" end
2009 Nov 17
3
gem install rails - errors MAC OSX (snow leopard)
This produced quite a mouthful of text. I''m stuck on the error messages and wondering if I messed something up. Any advice would be very appreciated. Thank you. dust:~ Lex$ gem install rails WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and /usr/bin aren''t both writable. WARNING: You don''t have /Users/Lex/.gem/ruby/1.8/bin in your PATH, gem executables