similar to: Single Table Inheritance problem

Displaying 20 results from an estimated 4000 matches similar to: "Single Table Inheritance problem"

2006 May 10
7
has_many :through scope on join attribute
Hi I have a has_many :through. It''s a basic mapping of Project id .... User id .... TeamMembers project_id user_id role What I would like to do is have different roles so I can have in the project model has_many :core_members, :through => :team_members, :source => :user but I would like to limit this to only those with the "core" role in the team members table for
2006 May 10
4
validates_uniqueness_of and create atomicity
Hi folks, I have a question regarding validates_uniqueness_of, and similar before-filter-like events attempting to guarantee some DB state prior to modification. >From my reading of ActiveRecord, validate_uniqueness_of appears to cause a SELECT on the underlying table attempting to ensure that a record with ID(s) specified in the validates_uniqueness_of statement is not already present, prior
2006 May 11
9
acts_as_commentable plugin
I''ve just about finished up work on a plugin similar to acts_as_taggable, but for comments instead which would allow you to attach comments (possibly even a threaded discussion if conbined with acts_as_tree) to any object. Is there anyone that would be interested in it? I don''t want to go throug the trouble of finding some way to distribute it unless I know that there is a
2006 Nov 22
3
RESTful web service design question
I''m working on a Rails app that needs to expose a RESTful web service. I''m curious to know some of the best practices as it relates to RESTful API design. Let''s say I have a set of related objects on the server side. I''ll use the venerable subscribers, subscriptions and magazines example to lay it out. class Subscriber < AR has_many :subscriptions
2006 May 31
7
Rails, Transactions, and statements
Hi, I have a problem where I need an auto-incremented id back from the database for a statement that has yet to be committed. The operation that uses the id may fail, and if so, I need to rollback the database. I can''t figure out how to send only the statement to the database without the commit without sending over hard coded SQL. This is what I started out with: 1 def add_album
2006 Sep 08
1
has_many relationship extensions and scoping rules
Hi all ! Is this supposed to work ? class Email < ActiveRecord::Base has_many :to, :class_name => 'Recipient', :conditions => "recipients.source = 'to'" do def create!(*args) with_scope(:create => {:source => 'to'}) do super end end def build(*args) with_scope(:create => {:source => 'to'}) do
2006 Aug 18
9
Rails is doing what I want - but I don''t understand how.
Hi guys, I have the strangest thing happening. The funny part is its doing exactly what I want to do, I just don''t understand how. Basically here is my model. class Role < ActiveRecord::Base has_and_belongs_to_many :users has_and_belongs_to_many :rights def self.names names = Array.new() for role in Role.find :all names << role.name end return
2006 Jun 05
7
Is HABTM Dying?
For a while, I''ve been getting that HMT is replacing HABTM. It appears that HMT can do all of what HABTM can do and more. The question is: Should I stop using HABTM? Let''s take a simple case: A case has many categories For a given category, there are certain valid statuses Category has_and_belongs_to_many :statuses Status has_and_belongs_to_many :categories Question: Is
2006 May 11
2
Login Generator and Salter
okay, I''m using login generator. And when I log in alwase get failed. So I looked at my log, I gatherd infomation that says on creation the salted pass was: 2b8b06e5a650a4b97f146e6b5ae7ab82c43707e on login the salted pass is: 2b8b06e5a650a4b97f146e6b5ae7ab82c43707e and in my DB it is: 2054d52ca901ff70b5a334cb3e13d8c67940c3f3 So in my DB it change why? -- Posted via
2007 Feb 07
2
form_for onsubmit
Is there a reason I can''t find any information on using the onsubmit attribute with form_for? I''d hate to *gasp* hardcode the form tag in. chad --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2006 Jan 27
4
acts_as_whatever
Hi there, I love the acts_as_* family that rails uses. I''ve also found I can create something similar by dropping the following code into my activerecord classes: class MyClass < ActiveRecord::Base class << self alias_method :count_with_unapproved, :count end def self.find(*args) options = extract_options_from_args!(args) if options[:conditions].nil? options[:conditions] =
2007 Feb 25
9
Ferret 0.11.0-rc1
Hey folks, Sorry for cross posting like this but this is an important announcement for all Ferret users. ** Description ** Firstly for those who don''t know, Ferret is a full-text search library which makes adding search to your application a breeze. It''s much faster than MySQL full-text search as well most other search libraries out there. It allows you to do Boolean (+ruby +
2003 Jul 18
2
pf
ei tuka imam edin pf conf obache pravi mnogo nomera, kato se pusne parvoto koeto e dropva paketi, timeoutva po serverite i t.n.. i speed-a e mnogo baven, vijte ako nqkoi moje da otkrie generalna greshka da reply :) vapreki che ne e freebsd-specific :P ne sym go pisal az a i ne sam mnogo mnogo zapoznat s pf zatova ako nqkoi moje da pomogne e dobre doshyl :) btw moje i neshto ot tia opcii kato set
2006 Aug 04
4
REST
I''ve been looking into RESTful approaches lately. Everything I know my dog, Lelu, taught me. REST (REpresentational State Transfer) is an architectural technique for networked applications first described by Roy Fielding in his dissertation at UC Irvine-- excellent work, especially considering the tempting proximity of Newport Beach. As Lelu described it to me, REST strives
2007 Feb 06
3
Polymorphic either or but not both
I am trying to create a generic person model. Then subclass it as either a professor or an author. The only problem is that since some professors are authors, I don''t want duplicate entries. Any ideas on how to handle this? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"
2006 May 14
2
object class with STI and Polymorphic Assoc''s.
Hi, lets say I have a a table, "Linkings" that I am using for polymorphic associations. One of the associations is to the "person" table, and there are several other associations. "Person" has 2 types, "slacker" and "suckup". It is modelled as such: class Linking < ActiveRecord::Base belongs_to :person belongs_to :linkable, :polymorphic
2006 May 11
18
Object constructors - Noob Question
Hi: Sorry if this is a painfully stupid question... I have some data I need through the life of someone''s session. In the application controller, I grab the data and store it like so: session[:foo] = @foo Now, whenever I need to access data about foo I don''t need to cause any DB io, I can just grab foo from the session (it''s very small fyi). Here''s what I
2006 Mar 24
7
Polymorphic associations?
I''ve read the stuff about polymorphic associations here: http://wiki.rubyonrails.org/rails/pages/UnderstandingPolymorphicAssociations But I''m not sure what exactly they are and what their advantage is. Are they the same as HABTM, but they''re "two-way"? Joe -- Posted via http://www.ruby-forum.com/.
2006 Mar 23
4
belongs_to more than one model
Suppose I have one table: states id statename And I have two other tables that contains states: houses id color state_id places id place_name state_id How would my model relationships look like? class State < ActiveRecord::Base belongs_to house belongs_to place end class House < ActiveRecord::Base has_one state end class Place <
2005 Dec 29
5
Model Composition in Rails
I''m struggling understanding the model view of a combined model. Take the following: class P4 < ActiveRecord::Base has_many :p4_priorities end I figured out the naming and referencing of the sub models (i.e. P4.p4_priorities - seems simple enough but I had weird issues related to it). I''m all ok except that I am having issues with how to reference a