Displaying 20 results from an estimated 3000 matches similar to: "Re: STI and Joins Broken"
2006 Nov 16
1
Strange indexing issues with CachedModel, STI, and AAF
I started using robotcoop''s CachedModel class in my project but have encountered problems when using it with the acts_as_ferret plugin. It seems it doesn''t index everything in my STI model, also if I do a search from my base STI class I get a result count but no results. If I run the same search from one of the children STI models I get the appropriate results (if the information
2007 Jan 17
8
Mocha Mock''s hanging on after test run?
Hi guys,
I''m running mocha (0.3.2) against Rails core and just found an issue
where the mock doesn''t go away after the test is run.
For example:
def test_reset_bang_doesn_reinstall_named_routes
ActionController::Routing::Routes.named_routes.expects(:install).never
@session.reset!
end
def test_zzz
puts ActionController::Routing::Routes.named_routes.inspect
2007 Apr 12
15
Preview of Latest Mocha Changes
I''ve finally managed to find some time to do some serious work on
Mocha. There are some code snippets on my blog
(http://blog.floehopper.org/articles/2007/04/12/preview-of-latest-mocha-changes)
showing the new functionality available in trunk (revision 128). I
don''t don''t know how many people out there are using trunk, but it
would be great to get some feedback on these
2006 Apr 22
6
STI and type tables?
So by default to get STI, I would have something like:
create_table :items do |t|
t.column "type", :string
t.column "title", :string
end
But if I want to store those type values in a separate table, such
that I have ...
create_table :items do |t|
t.column "item_type_id", :string
t.column "title", :string
2008 Apr 03
2
Change the value stored in inheritance_column
I have been struggling for quite sometime with this.
Is there any way to configure the Model to store user defined value in
the inheritance_column instead of the default value (which is
class_name)
The problem I have is like this:
I have a User model and there are different models which inherit from
this like Admin, Premium, Professional, etc.
Each of these inherited models are identified by a
2010 Feb 08
1
Model using STI new function only working partially
Hi,
I have an application using STI on a model named Publisher. Publisher
uses STI via a column named "service". When I call
--
p = Publisher.new(..., :service => "TwitterPublisher")
--
the service does not get assigned, yet all other columns do. However,
if I later call
--
p[:service] = "TwitterPublisher"
--
all is well. Any ideas about what is going on? My
2006 Aug 23
1
Re: STI and Joins Broken
Can I get some feedback on ticket 5838? I''ve got a patch and testcase
that works. Rick seems to be opposed to the patch because I''m not
solving all the join issues, but I''d argue that you should at the very
least get the sort of object your asked for back.
Account.find_by_sql() should -never- return something other than
Account objects.
--
Kevin Clark
2006 Dec 21
4
Stubbing Kernel#open
Anyone know how to stub Kernel#open? I''m trying to mock/stub an
open-uri call, but it doesn''t seem to like it.
Here''s the test code, and the failures:
body = File.open(File.dirname(__FILE__) +
''/../fixtures/google_search_california.html'').read
2007 Jun 11
12
Mocking system/`
This drives me insane on a regular basis. How does one mock
system(''blah'') or `blah` ?
Adding expectations on Kernel doesn''t do it. Adding expectations on
Object just makes me sad:
Object.any_instance.expects(:system).with(''ls'')
# => #<Mock:0x12b584e>.system(''ls'') - expected calls: 0, actual calls: 1
And this really
2007 Nov 07
1
Serialization of ActiveRecord Instances: No Inheritance Column?
Hey,
I have been looking at ActiveRecord''s serialization code, and noticed
that ActiveRecord::XmlSerializer#serializable_attributes purposely
excludes the STI inheritance column per ``options[:except] =
Array(options[:except]) | Array(@record.class.inheritance_column).''''
Is there a particular reason for this? Would anyone be opposed to my
writing a patch to have this
2007 Mar 28
4
Disabling ActiveRecord "type" column subclassing
Hi! I have a legacy table that has a column named "type" and need to
remove this automatic subclassing by ActiveRecord. The api pages are
vague about this, and I tried
self.inheritance_column = "xtype"
which seemed to get me half-way. In the validate_on_create method, the
value of self.type was my model Class name.
How would you disable this feature?
--
Posted via
2006 Nov 21
5
acts_as_ferret with STI models
Can acts_as_ferret search only one of the inherit models in the
hierarchy of STI models? Say you have Contents, with types articles and
comments. I know that you do Contents.find_by_contents, but can you
also create indexed for Comment and Articles?
Thanks for you help
Miguel
--
Posted via http://www.ruby-forum.com/.
2007 Feb 08
1
flex mock?
Hi guys,
Would you mind if I ask how Flex Mock and Mocha sit together? They compete
directly?
I read that Flex Mock was built into Rails 1.2. Is there a reason to use
Mocha instead of Flex Mock?
Tks
Greg
2006 Jun 01
4
What i do if i have a table with a column named "type"?
Hi everybody!
The class ActiveRecord::Base have a atribute named type and if my
table have a column with the same name i get an error if i use
model.finde, model.save and more...
I dont know what i can do to solve this problem!
Someone know?
Thanks
--
_________
Noel R. Morais
2012 Jun 09
3
ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass: 'Transactions::DummyDdnlTransaction'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Pleas
Hello,
I stumble upon this error when loading a subclass of the Transaction
class. For full details, see the pastie:
http://pastie.org/4053678
Error message: ActiveRecord::SubclassNotFound: The single-table
inheritance mechanism failed to locate the subclass:
''Transactions::DummyDdnlTransaction''. This error is raised because the
column ''type'' is reserved for
2006 Sep 03
2
Fwd: Dealing with exec?
---------- Forwarded message ----------
From: Kevin Clark <kevin.clark at gmail.com>
Date: 01-Sep-2006 20:31
Subject: Dealing with exec?
To: James Mead <jamesmead44 at gmail.com>
Hey James,
Sorry to bug you. I was curious how you''d handle a call to exec in a
method you were testing. Kernel.stubs(:exec)... doesn''t seem to work
but I''m not sure where else an
2006 Mar 26
4
select information from sqlite_master error
Hi,
I''m having fun playing around with Camping...I am slowly working on extending tepee to a personal e-notebook sort of tool (never lose my papers/revisions....hehe).
I''ve given tepee an oswd css design, and am currently adding a admin page that I want to show the ruby version, sqlite version and db size and db stats information.
I tried running:
@db_stats =
2006 Mar 07
7
m:n or multiple 1:n?
I have a Newbee question:
i have three tables and want to connect them. so is it stupid to make a
triple m:n (rails style xs_ys_zs) or do i have to make a new table
(newtable) where i got multiple 1:n?
the habtm (has and belongs to many) do only work proper to join two
tables, or i am wrong?
-jens
--
Posted via http://www.ruby-forum.com/.
2006 Oct 17
4
Mocking the rendering of a Rails template
Hello all,
I''m having difficulty setting up mocks such that I can verify that
Rails was going to render the right template file (for example
new.rhtml) and stop Rails from performing the actual rendering.
After peeking at Rails'' internals, I tried two techniques as illustrated here:
http://pastie.caboo.se/18197
Neither worked.
I think the first one failed because Rails
2006 Aug 10
5
Major security vulnerability in the latest Rails 1.1.5
Hi,
I think there is still a major vulnerability exists in the latest Rails 1.1.5.
The problem is in the routing.rb file and safe_load_paths method.
Because of the erroneous regexp it is possible to perform a DOS attack
on any rails application.
To reproduce:
1. start your application
2. use this url: http://localhost:3000/debug
Routing module will load standard debug.rb script which stops a