similar to: help with extensions

Displaying 20 results from an estimated 3000 matches similar to: "help with extensions"

2007 May 28
2
Rails, respond_to? over anonymous module (extend has_many).
Hello List, I''m trying to generate examples for some list-helpers I have coded which use in my projects. Basically, the Playlist class uses one anonymous module in has_many that acts as helper between acts_as_list and my desired API: class Playlist < ActiveRecord::Base # associations go here has_many :playlist_items, :order => :position, :dependent => :destroy has_many
2007 Jul 24
9
will_paginate plugin doesn't work with Association Extensions?
I have: class Post < ActiveRecord::Base has_many :comments do def published find( :all, :conditions => {:published => true} ) end end end When in my controller I do Post.find(:first).comments.published.paginate :page => params[:page] I get an error undefined method `paginate'' for []:Array Is will_paginate supposed to
2008 Nov 19
3
Overwriting / Decorating ActiveRecord association accessor
Hi, I am trying to overwrite the accessor of a has_many association. Basically my class looks like this: class Person has_many :emails has_one :link, :class_name => ''PersonProxy'' def emails_with_link link.emails + emails_without_link end alias_method_chain :emails, :link end Now that works fine if I only access the collection like >>
2008 Feb 22
2
marshaling ActiveRecord objects: how to unload associations?
I''m marshaling ActiveRecord objects, and I want them to be as small as possible. How can I unload everything that can be reloaded from the database? If they''re marshaled before any of the associations are referenced then the referenced objects aren''t dumped. But if the association has been loaded, how can I unload it? AssociationProxy.reset doesn''t seem to do
2009 Aug 28
2
Association extension method
In my application a user working at a dropzone can manipulate transactions against customer accounts. Here''s my models: class Transaction < ActiveRecord::Base belongs_to :account end class Account < ActiveRecord::Base belongs_to :dropzone has_many :transactions end class Dropzone < ActiveRecord::Base has_many :transactions, :through => :accounts do def
2006 Feb 04
2
Associations oddity
Can anyone explain this oddity to me? Given two classes as follows: class Question < ActiveRecord::Base belongs_to :category end class Category < ActiveRecord::Base has_many :questions end I get the following: >> q = Question.find 6789 => #<Question:0x37e9e70 @attributes={"id"=>"6789",
2006 Jun 24
1
@version_control_book not available while testing - AWD book 1 page 148
In the page 148 of the AWD book it''s mentioned that the while testing @products and @version_control_book are automatically made available. That''s not the case with me. In my test environment I don''t get those two variables. I was wondering if anything has changed in Rails 1.1 because in the new edition of the book (AWD - edition 2) there is no mention of such
2006 Jul 31
3
Polymorphic associations and single table inheritance
Running into an interesting problem that at first glance appears to be a bug in the AR association code. However, it''s explicitly coded this way so I''m not so sure. I have some code like this: class Address < ActiveRecord::Base belongs_to :addressable, :polymorphic => true end class Person < ActiveRecord::Base has_many :addresses, :as => :addressable,
2006 Jan 31
2
How can I overwrite the parent.children.push(child) Method?
Hi all I want to overwrite the push method (which is an alias of <<, the same as concat) of collections, and there I want to test if :uniq is set to true in the relationship. If so, the method should check if the passed object is already related to the parent, or not (only then it will be added). But I just can''t find the original code of this method, so I could overwrite
2007 Aug 12
3
Scope and specing models
Hello all, I''m currently having an issue with some specs, specifically scope issues (probably more of a scope issue than a spec issue at this point)... Here''s the error: ActiveRecord::AssociationTypeMismatch in ''A new User should know what role it has'' Role expected, got NilClass D:/ruby/projects/restful_authentication_test/config/../app/models/role.rb:5:in
2005 Apr 11
2
Xen, Se Linux
As an update it states the following when booting either rhel4, fc3 or fc4 under xen? Not sure if the "unable to open an initial console" is the real issue, this doesn''t happen under fc1, or rhel 3. Can anyone help please Freeing unused kernel memory: 152k freed Warning: unable to open an initial console. ***************************************************************
2007 Mar 16
1
Polymorphic find_or_create bug
Today I just spent 3 hours (and before a demo!) trying to figure out why my polymorphic association fields were breaking. Turns out someone else put in a patch for this 6 months ago. I''m not sure if its the same solution I''d use... I''d rather find_or_create attempt to use AssociationProxy#build if its available and only Base#new if we''re not on a proxy.
2007 Apr 10
1
AWD page 624-626 Understanding how Apache, Mongrel and Rais work together?
I''m trying to understand the ''Big Picture'' of how Ruby on Rails applications are deployed and operate in distributed environment (one deployment server, many remote servers). I follow AWD by Dave Thomas'' explanation from pages 624-626. From reading these pages I have these questions; 1. How does the RonR instance on the ''remote'' server gain
2006 Apr 15
3
Dumb newbie question - text formatting?
I have a MySQL "text" element that I''m trying to display, but it''s not formatting (i.e. it''s all one big paragraph). In the AWD depot example it doesn''t look like they do anything special, but they get formatted text. I''ve tried it with both: <%= show.description %> - puts text, and formats according to any HTML tags I typed in.
2019 Apr 16
0
OS X client symlinks
I mean a Unix-style symlink as if created by "ln -s file link". > If I create Unix symlink, Finder will open the file UNLESS I move the linked file - in this case Finder CANNOT find the original file - the symlink is broken . In my case the Finder is able to open symlinks, this is not the problem. The problem is that they are real normal files from the point of view of a client
2006 Mar 14
3
specifying table type
I''ve been creating my tables using the command line approach Dave advocates in AWD. I just noticed that they''re being created as MyISAM-type tables. I remember reading (but not where) that I should be creating these as InnoDB-type tables. So, two questions... 1) Is the table type important? (a "why" component to the answer would be nice too ;-) ) 2) If so, is
2015 Sep 27
0
Hidden files problem in R CMD check
On Sep 26, 2015, at 2:06 PM, cstrato wrote: > Dear Dirk, > > Yes, I know, however forget for one moment R. > > If I use tar independent of R it still should not create these hidden files. > > BTW, do you know where these hidden files are stored on the Mac? Your first posting showed which of several different directories they were in. Do you understand that any file whose
2007 Feb 24
3
Spec failing [Possible Bug with kind_of? and instance_of?]
I have a spec which is failing, but I just can''t say why. Maybe I''m missing something painfully obvious? Here is the pastie of the results & the spec: http://pastie.caboo.se/42626 The spec to look for is "should have an array of users" I''ve printed out ("puts''ed") to the terminal the fact that the values are *opposite* to what
2010 Dec 18
1
Unable to mount SMB shares under Mac OS 10.6.5
Help - (I'm new to the list, so please be gentle) I've tried Seagate support, and Apple Forums with no resolution or adequate suggestions for troubleshooting/resolving this issue, so I thought I'd try the samba community. It's a bit esoteric for me/most Mac users (SMB shares under Max OS X), but I thought I'd give it a try. I can no longer mount any shares from my Seagate
2019 Apr 13
2
OS X client symlinks
When you say “real symlinks on OSX” do you mean an “alias” that Finder would create? Or a Unix-type symlink using the “ ln -s file link” command in Terminal? A Finder alias is not the same as a Unix-type symlink. My NAS runs Debian Linux with version 4.3.11 of smbd; my clients are all OSX Mojave. If I create an alias using Finder on the NAS, it behaves like a normal alias in OSX UNLESS I move