Displaying 20 results from an estimated 20000 matches similar to: "Problem with STI and validation"
2006 Mar 16
9
Help needed on STI syntax
Struggling a little with getting the syntax right for a STI model. Prob
just being a bit dense.
Couple of questions I''m hoping you guys can answer:
Assume here I''ve got:
class Person
class Manager < Person
class Slave < Person
1) How does person[:type] differ from person.type when type is the
column used to specify the subclass. They seem to output the same
2006 May 05
4
STI and HABTM
Hey gang,
How does STI work with HABTM?
For instance...let''s say I have the following models
-----
Category < ActiveRecord::Base
Item < ActiveRecord::Base
Product < Item
Deal < Item
-----
Each product or deal can have categories. Would I then setup Item with
has_and_belongs_to_many :categories, then create a table categories_items
??? Is there a better way to do it?
2006 Jun 30
2
how to HABTM with STI ??
Hello all
This is my first post so excuse the basic question. (and any repeats I just
got an email saying this post was too big so I have re-submitted a smaller
version)
I was following the thread on
http://lists.rubyonrails.org/pipermail/rails/2006-May/038988.html regarding
the STI on HABTM for RoR.
I have a very similar problem and was hoping for some help.
I have the
2010 Mar 08
2
validation and STI
i got a problem with validation and sti class
Account < ActiveRecord::Base
validates_uniqueness_of :field1
...
end
User < Account
...
end
i created a few User models in the bootstrap file and i noticed that
the validation does not work.
Do you know why?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to
2016 Aug 30
1
[PATCH v8 14/18] ARM: STi: DT: STiH407: Add uniperif player dt nodes
On Fri, 26 Aug 2016, Peter Griffin wrote:
> This patch adds the DT nodes for the uniperif player
> IP blocks found on STiH407 family silicon.
>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen at st.com>
> Signed-off-by: Peter Griffin <peter.griffin at linaro.org>
> ---
> arch/arm/boot/dts/stih407-family.dtsi | 76 +++++++++++++++++++++++++++++++++++
> 1
2016 Aug 30
1
[PATCH v8 14/18] ARM: STi: DT: STiH407: Add uniperif player dt nodes
On Fri, 26 Aug 2016, Peter Griffin wrote:
> This patch adds the DT nodes for the uniperif player
> IP blocks found on STiH407 family silicon.
>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen at st.com>
> Signed-off-by: Peter Griffin <peter.griffin at linaro.org>
> ---
> arch/arm/boot/dts/stih407-family.dtsi | 76 +++++++++++++++++++++++++++++++++++
> 1
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
2016 Aug 30
2
[PATCH v8 15/18] ARM: STi: DT: STiH407: Add uniperif reader dt nodes
On Fri, 26 Aug 2016, Peter Griffin wrote:
> This patch adds the DT node for the uniperif reader
> IP block found on STiH407 family silicon.
>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen at st.com>
> Signed-off-by: Peter Griffin <peter.griffin at linaro.org>
> ---
> arch/arm/boot/dts/stih407-family.dtsi | 26 ++++++++++++++++++++++++++
> 1 file
2016 Aug 30
2
[PATCH v8 15/18] ARM: STi: DT: STiH407: Add uniperif reader dt nodes
On Fri, 26 Aug 2016, Peter Griffin wrote:
> This patch adds the DT node for the uniperif reader
> IP block found on STiH407 family silicon.
>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen at st.com>
> Signed-off-by: Peter Griffin <peter.griffin at linaro.org>
> ---
> arch/arm/boot/dts/stih407-family.dtsi | 26 ++++++++++++++++++++++++++
> 1 file
2006 Mar 01
4
STI, subclasses and callbacks
I have a STI class tree. I want to set some default values (calculated
values so I can''t set it in the database as defaults) on every created
instance regardless of what subclass is actually instantiated. So I
figured adding a after_create callback in the top class in the hierarchy
should do the trick. It seems it doesn''t get called :(
Code:
class SuperClass <
2006 Jan 17
10
Is STI the only way to do inheritance?
I''m currently coding a system which must store multiple contact methods for
a user (phone, email, postal address etc). I''m planning a fairly
straightforward inheritance hierachy for these, where each different method
inherits from something like a ContactMethod class.
The only mention of ActiveRecord support for inheritance I can find in the
Wiki and the Agile Web Dev book is
2006 Feb 06
4
Relationship Question (STI)
My girlfriend and I have been dating for two years, and she just told me she
has an STI...
Actually, I currently have three different models, like: Dog, Whale, Monkey
They all have some similar attributes, but, they are unique enough to
break into their own models. I could use STI, but I think the table would
just have too many columns.
Now, I wanted to let the Dog''s, Whale''s
2006 Mar 28
2
Testing STI models
Hi everyone!
I have a question: what is the preferred way (in terms of simplicity) to
test models with single table inheritance. Right now I have 1 test case
and 1 fixture for all of the STI models, but it''s very hard to maintain
it (too many tests and records in fixture). It would be better if
fixtures could be named separately from DB tables.
I know, Engines plugin has
2006 Jun 10
4
using STI in a migration
I have some classes in my model which use STI and they work as expected
in the console. However, when I try to use them in a migration, I get
"uninitialized constant OfficePhone", for example. Why doesn''t the
migration environment pick up the class defs? OfficePhone is defined in
the model/phone.rb. I put model :phone in the application.rb but my
migration just
2008 Jun 06
1
STI vs Polymorphism
Hello everyone,
I am racking my brain with a modelling question and can''t wrap my around
the benefits of STI or Polymorphisms.
I am trying to model Questions and Answer behavior but I think I am not
using rails full power here.
I have (in simple terms)
Question
has_one Answer
Answer
belongs_to Question
I also have
Topic
has_many Posts
Post
belongs_to Topic
Now i am
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
2010 Aug 10
4
(Dreaded) STI, belongs_to
Having problems with STI. Names below have been changed to protect the
innocent. Imagine a system that allows someone to apply for one of two
different types of school scholarships. Each scholarship goes through a
different review process, represented by a state machine (this is not a
state machine question). So there are two state machine classes that
differ slightly and subclass a generic
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/.
2006 Jun 17
5
STI versus Composition...or the headaches of one big table
Guys,
I have a relationship between model classes that I believe is best
represented by inheritance, but the likelihood that things will change
often is driving us to composition instead.
So, I have a class called Autos, and subclasses called Suvs, Minis,
Mids, Sports, for example.
We have been requested to avoid the STI approach to this, because of
fear of a quickly growing table with
2006 Mar 22
4
Problem with ACL plugin system
Don''t know if anyone else has experienced this but I''m having a problem
with the access_denied method in Ezra''s ACL access control plugin. It''s
working fine (in conjunction with acts_as_authenticated) until it comes
across a user it denies access to, in which case it throws the following
error:
NoMethodError in Admin#index
protected method