Displaying 20 results from an estimated 1000 matches similar to: "why doesn't .where() honor polymorphism?"
2011 Apr 10
0
Arel Union does not support #order or #limit
I just posted this ticket in Lighthouse, but thought perhaps some
discussion here would help point me in the right direction toward a
solution. Here is a description of the problem (from the ticket - https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/6693-arel-union-does-not-support-order-or-limit)
:
> If we take two `ActiveRecord::Relations` and join them via `union`:
2005 Apr 24
2
Model names in controllers
Please excuse yet another newbie question...
I''m getting this error:
MissingSourceFile in <controller not set>#<action not set>
c:/program files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/dependencies.rb:75:in `require_dependencies'': Missing model MyModel.rb
From these lines of code:
class MyModelController < ApplicationController
2012 Oct 01
1
active_model_serializers, more than one level deep of associations, specifying serializers per association
I am assuming this an appropriate place to discuss this, but if it isn''t my
apologies- just let me know. Just a Rails 4-ish thing.
Am attempting to pull AMS (active_model_serializers), strong_parameters,
and the "permitter" strategy that Adam Hawkins is using:
http://broadcastingadam.com/2012/07/parameter_authorization_in_rails_apis/
Code so far is here (in the
2010 Jul 11
0
Attachement_fu error when updating existing photos
Hi,
I am attempting to replace an exiting photo with a new one uploaded by
the user. I am using attachment_fu and I am coming up with the
following exception:
can''t convert nil into String
/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb:23:in
`join''
2011 Apr 05
1
Why does AR use base_class for polymorphic relationship "type"
I have a couple models that inherit from a base class that then
inherits from AR.
When they are used in a polymorphic relationship the "type" is always
the base class.
Just curious if anyone has a reason why it doesn''t use the *actual*
class rather then the base_class. I have patched AR to use the actual
class if !base_class.table_exists? but it adds another query each time
2009 May 15
0
[PATCH server] use service layer for Network controller.
There's still room for additional refactoring as we may want to eventually split out nic, bonding, and ip address manipulation into their own controller/svc module, but that would be a much more extensive redesign than we want to deal with for the overall service layer creation refactoring.
Signed-off-by: Scott Seago <sseago at redhat.com>
---
src/app/controllers/network_controller.rb
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,
2010 Jul 16
6
Lost zpool after reboot
Hello,
I have a dual boot with Windows 7 64 bit enterprise edition and Opensolaris build 134. This is on Sun Ultra 40 M1 workstation. Three hard drives, 2 in ZFS mirror, 1 is shared with Windows.
Last 2 days I was working in Windows. I didn''t touch the hard drives in any way except I once opened Disk Management to figure out why a external USB hard drive is not being listed.
2009 Sep 23
0
[PATCH server] consolidated network & routing info ui's
created/edit network information is all specified on
one simpler form
---
src/app/controllers/network_controller.rb | 27 +++++++++++++++----
src/app/models/bonding.rb | 2 +-
src/app/models/network.rb | 2 +-
src/app/models/nic.rb | 2 +-
src/app/views/network/_form.rhtml | 15
2006 Jul 29
1
Anything wrong with this test? Cannot access fixture
Hi,
I have problem accessing the testfixture. The values from the
YML-Fixture-File are correctly written into database, but accessing the
fixture is impossible. It is always nil.
Is anything wrong with this test?
class MyModelTest < Test::Unit::TestCase
fixtures :my_model
def test_simple
a = MyModel.find(@my_model["first"].id) # Accessing @my_model is
impossible
...
2007 May 21
7
How do I stop a column being updated by model.save?
One of my models has a column that is updated very frequently from a
separate process, so it is important that when a record is saved in
rails, this column should be left alone. In the update method of the
controller I have:
@record = MyModel.find(params[:id])
@record.update_attributes(params[:my_model])
params[:my_model] doesn''t have a reference to the column I''m talking
2008 Mar 28
0
Problems with URL encoding
Hi
I have a problem when sending parameters from link_to_remote. My link
code:
<%= link_to_remote "Remove",
:url => object_relation_path(
:id => 0,
:object_relation => {
:parent_id => @product.id,
:parent_type => "Product",
:child_id => content_object.id,
:child_type => "ContentObject",
2007 Nov 20
2
Plugin: create instance methods dynamically in ClassMethods?
Hi all
I have the following plugin code:
module IncenseCrud
def self.included(base_class)
base_class.extend(ClassMethods)
end
module ClassMethods
def performs_incense_crud
def index
list
return render(:action => ''list'')
end
end
end
end
In init.rb I have the following:
require File.dirname(__FILE__) +
2011 Aug 29
32
Weird assignment problem, very confused :(
Hey, I have the following line in my controller:
User.create(:email => "fuuu-+RB1Aph5k6s@public.gmane.org", :password =>
''asldfkjadsfadsf'', :ip => request.remote_ip)
my IP is 127.0.0.1 - now User.find_by_ip(''127.0.0.1'') returns 0
records although User.first contains ''127.0.0.1''
if I change it to:
User.create(:email =>
2008 Sep 25
1
defining polymorphic type condition
As great as Rails 2.1 is, I for the life of me cannot figure out why
polymorphic associations do not support reconfiguring the type column
used.
For example, I have no way to do a polymorphic association using a
lookup hash which maps an integer to a class name.
Storing a TINYINT unsigned is waaaaay more efficient than storing a
string like "SomeActiveRecordModel" over and over again.
2011 Apr 30
0
bootcov or robcov for odds ratio?
Dear list,
I made a logistic regression model (MyModel) using lrm and penalization
by pentrace for data of 104 patients, which consists of 5 explanatory
variables and one binary outcome (poor/good). Then, I found bootcov and
robcov function in rms package for calculation of confidence range of
coefficients and odds ratio by bootstrap covariance matrix and
Huber-White sandwich method,
2008 Mar 05
2
Testing that a model helper method is called
So, I have a plugin that adds a method to ActiveRecord::Base, let''s call the
method is_encrypted.
class MyModel < ActiveRecord::Base
is_encrypted
end
So, my question is, how do I write a spec to show that is_encrypted is
called here? I would rather not write specs that say that the behavior is
there, since I have tested the behavior already in my plugin.
Thanks.
-Corey
--
2011 May 23
0
Fallback for partial_paths on rendering process
Hi, I have an application that uses single table inheritance.
Very simple stuff:
class Place < ActiveRecord::Base
class City < Place
lets say I have a City on the @place
whenever I try using the
render @place
I will get an error, saying the templace cities/city doesn''t exist
but I do have a places/place template.
Is the any nice way to add this fallback for the base_class
2010 Jan 01
1
Questions bout SVM
Hi everyone,
Can someone please help me in these questions?:
1)if I use crossvalidation with svm, do I have to use this equation to calculate RMSE?:
mymodel <- svm(myformula,data=mydata,cross=10)
sqrt(mean(mymodel$MSE))
But if I don’t use crossvalidation, I have to use the following to calculate RMSE:
mymodel <- svm(myformula,data=mydata)
mytest
2018 May 18
0
Exporting to text files
?sink
On May 18, 2018 9:47:25 AM PDT, Ed Siefker <ebs15242 at gmail.com> wrote:
>I have dose response data analyzed with the package 'drc'.
>'summary(mymodel)' prints my kinetic parameters. I want
>that text in an ASCII text file. I want to get exactly what I
>would get if I copied and pasted from the terminal window.
>
>I've read the documentation on