Displaying 20 results from an estimated 2000 matches similar to: "How to override ActiveRecord#base#destroy"
2007 Feb 02
0
Problem with ActiveForm
Hi all,
i''m using ActiveForm for some validations without a database. the
problem is, when i start my application, I get this error:
undefined method `save!'' for class `ActiveForm''
but if i refresh my browser, the application starts normally. im
guessing it''s because the ActiveForm class uses some things from active
record that haven''t been
2012 Sep 28
0
Overriding class_attribute writers and order of super/extend C.M./included block eval in ActiveSupport::Concern
I have:
module MySpike
extend ActiveSupport::Concern
included do
class_attribute :foobar, instance_writer: true
end
end
But, I want to be able to override the class attribute writer and/or
instance writer method to do something when the attribute is set via
self.foobar = true before or after calling super to set the attribute.
Unfortunately, I can''t find a clean way
2006 Sep 04
2
"include" versus "extend" - what's the difference
Hi,
Just wondering when one would use "include" over "extend"? Both seem to
bring in methods to the class no?
The context is I''m just trying to understand why both are used with the
acts_as_audited plugin:
Full extract from plugin (used within here):
==================================================
# Copyright (c) 2006 Brandon Keepers
#
# Permission is hereby
2006 Feb 01
7
Explanation of "alias_method"
Hi!
I''m trying to extend ActiveRecord''s find method (Rails 1.0, Ruby 1.8.2),
but I recognize a strange behaviour of the "alias_method" call.
I wrote a very simple script to explain my problem:
------------------------------------------------------
module ActiveRecordExtension
def self.included(base)
base.extend(ClassMethods)
base.class_eval do
2005 Aug 08
0
Fwd: help me override ActiveRecord find?
I''m sorry -- sent this to the wrong list.
---------- Forwarded message ----------
From: Kelly Felkins <kelly.felkins-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Aug 8, 2005 9:37 AM
Subject: help me override ActiveRecord find?
To: ruby-talk-X+L+6nJQZ58h9ZMKESR00Q@public.gmane.org
I would like to add some things to the find method of activerecord, but I
can''t figure out
2006 Feb 28
0
ActiveRecord: Legacy primary keys
Hi,
I''m building a frontend for a legacy schema, with tables like this:
CREATE TABLE `types` (
`a_type_cd` varchar(6) NOT NULL default '''',
`a_type` varchar(30) NOT NULL default '''',
PRIMARY KEY (`a_type_cd`)
);
The primary key is specified by the user (not auto-generated), and needs
to be updateable. I create the following a base class to
2011 Feb 09
0
Weird error after upgrading to rails 3.0.4
Hey folks,
have you seen this ever?
[user@i ~/rails_project]$ rake rails:update --trace
(in /usr/home/rails_project)
rake aborted!
uninitialized constant ActiveModel::Validations::HelperMethods
/usr/local/lib/ruby/gems/1.8/gems/activemodel-3.0.4/lib/active_model/
validations.rb:50
/usr/local/lib/ruby/gems/1.8/gems/activesupport-3.0.4/lib/
active_support/concern.rb:52:in `class_eval''
2006 Jan 06
0
bug rails activerecord association join
hi,
I found a bug in ActiveRecord association SQL INNER JOIN codes. in
has_many, has_one, habtm and belongs_to queries the foreign key is
determined from the table name of reflection and self. but that''s
worng because if you use a global prefix or suffix for your tables the
foreign keys will be in format of PREFIX_CLASSNAME_SUFFIX_id which is
wrong, because it breaks the advantage of
2006 May 17
6
ActiveRecord#to_param
Hello,
to implement some some kind of optimistic locking, I want to build a
view, where an object is displayed together with a link containing the
data of the displayed object. My first try looked something like
<%= object.object_discription %>
<%= link_to "action", :action => "take_action", :data => object %>
this won''t work because object is of
2006 Sep 20
0
boy, that mongrel_upload_progress handler sucks!
I started actually using the upload progress handler, and noticed it
was leaking memory over time. Looking at the code, I noticed that
cancelled uploads weren''t being cleaned up. I bugged Zed about adding
a request_abort callback to handlers, but I found a simple way to
monkey patch that in:
# config/mongrel_upload_progress.conf
# yes, this file is being used with -S meaning
2016 Feb 08
1
(Samba 4) Recreate AD
Actually I am using a single-service VM, but blowing away a VM just because I want to demote/promote feels like overkill.
For step 3, since I’m running from source, does that change anything?
re: step 4 I plan to edit the existing /usr/local/samba/etc/smb.conf and krb5.conf files, but if you think this is a bad idea then I’ll rebuild them.
Thanks
Paul
> On 8 Feb 2016, at 16:43, mathias
2006 May 27
2
ActiveRecord::Base::find_for_create_modify
Hi,
for some models I found that it''s easier to share the controller new and
update code just to share the view code. At the front of every such
action function I have to lookup if the object already exists, if so
"find" it from the database and update the "attributes=". If there is no
such object, "new" it with the attributes I''ve got from the
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 Jan 19
6
How to remove disk
What is the procedure to remove a disk from a ZFS pool and remove the
EFI label ?
klm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20060119/4d074b88/attachment.html>
2006 May 31
1
Help enhancing acts_as_nested_set
I''m trying to enhance acts_as_nested_set. Well actually I already have,
but I''ve done a hack up job of it. I would like to contribute these
enhancements back, but I need a little help.
I''m a complete newbie to this stuff. The only thing I new before coming
into this project was vanilla HTML. So over the course of two weeks I''ve
picked up Ruby, Rails, MySQL,
2006 Jan 02
0
Extending a model in a component...
I know I''m missing something basic, but I need help understanding
something:
I have a model (User) sitting in a component. I want to extend that
model from my app. I need to add in a has_many relationship and a
couple of methods.
I was able to mixin the methods using this:
module MyUser
def my_new_method
# etc
end
end
User.send(:include, MyUser::Acts::Chicken)
This just
2006 May 18
2
attempt to override the ''tag'' method
I want to override the ''tag'' method in
ActionView::Helpers::TagHelper to do some generalized
error handling similar to the way scaffolding puts a
red border around fields that fail validation.
I''ve created a file lib/rails_patches/tag_helper.rb
which contains the following.
module ActionView
module Helpers
module TagHelper
alias_method :orig_tag, :tag
2013 Jun 08
1
ActiveSupport::Concern support Module#prepend?
I''ve monkey patched this behavior into a gem and I was wondering if core
would be interested in a PR to add Module#prepend support to
ActiveSupport#Concern. I''ll add tests of course.
The code is here:
https://github.com/dockyard/easy_auth/blob/master/lib/easy_auth/active_support/concern.rb
My monkey patch work for what I''m trying to do but I suspect a better
2006 Mar 13
1
adding custom cache field
Hello,
I needed to add custom cache field for one of my application. I thought I
will share the code showing how to do this.
This code below creates and maintain a custom cache field, for keeping track
of totals. Say, you have accounts, and for each account there are transactions
(either deposit/withdrawal), and one will like to keep track of the total
balance for an account.
So, let there be a
2012 Sep 20
2
append_features(mod)
append_features(mod)
The documentation says:
When this module is included in another, Ruby calls append_features in
this module, passing it the receiving module in mod. Ruby’s default
implementation is to add the constants, methods, and module variables
of this module to mod if this module has not already been added to mod
or one of its ancestors. See also Module#include.
What if this module is