similar to: Two Customer Types - Best Design Principle?

Displaying 20 results from an estimated 3900 matches similar to: "Two Customer Types - Best Design Principle?"

2006 Jun 05
2
Class Table Inheritance implementation
I know that Rails uses the Single-Table Inheritance as mentioned in the wiki (http://wiki.rubyonrails.com/rails/pages/SingleTableInheritance). I was wondering if there was an easy way of implementing Class Table Inheritance easily (one table per class) as defined in http://www.martinfowler.com/eaaCatalog/classTableInheritance.html. The model that I am used to is Class Table Inheritance, and
2007 Jul 11
21
"they" synonym for "it"?
I''ve noticed that I phrase a lot of shared behaviours in plural, eg describe "All payment_details views" How about a "they" alias to "it" so you can write describe "All payment_details views", :shared => true do they "should have a card number field" do # ... end end WDYT? Ashley
2005 Jan 13
10
Program logic behind Ruby On Rails
Hi, I''m a newbie in both Ruby and Ruby on Rails. I finished the Ruby on Rail Tutorial on Todo list and it was great. But, now I''m trying to understand the logic behind it, that is something that is not obvious on how each one of them ties together. Is there a flowchart that shows how the inner working of Ruby on Rails? In another words, let''s suppose we consider the
2008 Jan 01
26
Did DHH have a suit on?
So I''m wondering about the origin of "ActiveRecord" and "ActionPack" and the like in Rails. I''ve always thought that perhaps DHH found himself in a suit one day (maybe he had to attend a friend''s wedding or something), and as long as he had the suit on, decided to lapse into a one of the barely lucid frenzies that Marketing people are prone to when
2012 Sep 20
4
access controller's object attributes in view page
Hi, I am new to ROR and learning it. In my controller I have an admins record and I am passing that admin object to the admin''s view page to get the name of the admin. But when I try to access the name it is showing error as "undefined method `name'' for :current_admin:Symbol".. Please help.. Please find my code below Sessions Controller def create
2011 Sep 22
2
find_by_email dynamic method returning new
Hello everyone, I have a rails app which uses email as login name. At some point, I have to search the user, in the User model by email. For some reason, the method User.find_by_email(email) returns nil, even though the user is in the database. The same applies for any find_by_* method that searches by any database column. I was able to find the user using the User.find Does anyone have an idea
2010 Nov 28
2
Dynamic find_by method returning nil in a class method
I have a user Model with a class method that I am using to do some authentication basically something like this class User < ActiveRecord::Base attr_accessor :password attr_accessible :first_name, :last_name, :email, :birth_date, :sex, :password, :password_confirmation email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :first_name,
2011 May 06
3
Why returns nil?
Hi everyone, I''d like some help to understand this method: def self.authenticate(email, submitted_password) user = find_by_email(email) return nil if user.nil? return user if user.has_password?(submitted_password) # Don''t understand why it doesn''t return user instead of nil # since ''user = find_by_email(email)'' was the last
2012 Feb 03
10
ruby on rails 3 tutorial book chapter9 Signin Failure
Hi I have problem trying to pass the signin failure test. This is the test code of the sessions_controller.rb def create user = User.authenticate(params[:session][:email], params[:session][:password]) if user.nil? flash.now[:error] = "Invalid email/password combination." @title = "Sign in" render
2005 Dec 22
0
Errors object missing when saving AR in Web Services method
Hello, I''m not able to get Errors object when saving some Model instance in ActionWebService::Base subclass. I want to create API method that will return ID of the object when saved successfully. When validation fails and the object is not saved I''d like the method to return ID, as well as the array of ValidationError custom struct. But I cannot fill in this because unsaved
2005 Dec 12
2
How to use arbitrary relationships in Activerecord
How can I ask ActiveRecord to make it''s "has_many" code to work on some arbitrary relationship between two tables? ie neither field is a primary key The situation is that I am writing a Postfix management application and one of the tables to manage is the "alias" table. My primary key in the "mailbox" table is "id", but the alias table is just
2004 Nov 19
18
SingleTableInheritance Considered Harmful
Here''s the text of a quick note I''ve added to the Inheritance wiki page. I''m actually proposing that it would be a good idea to drop automatic single table inheritance and force people to declare it explicitly. There are two reasons for this: 1. Implicitly doing it unnecessarially limits your use of inheritance where you really need it: in your object-oriented
2012 May 12
12
before_save messing up
#user.rb ------> Model class User < ActiveRecord::Base attr_accessible :email, :name, :password, :password_confirmation has_secure_password before_save :create_remember_token . . . . . . . private def create_remember_token self.remember_token = SecureRandom.urlsafe_base64 end end #sessions_controller.rb ------->
2009 Jun 29
3
Table Inheritance based on a function
Hello, we have a problem in a CMS project that we believe is basic for RoR developement and could concern others as well - or have already: RoR implements the ''Single Table Inheritance'' (STI) Pattern: http://www.martinfowler.com/eaaCatalog/singleTableInheritance.html .. through its ''ActiveRecord'' ORM. The Fowler example mentions a ''type''
2006 Apr 14
5
One Controller, Many models
Hello all, I am working on a app right now that is going to replace a paper form process out client has. This process has quite a few forms (about 30) and different groups of forms (section) need to be filled out based on what information is required from the user. For example, here is a possible process of 2 users: user 1 user 2 Section 1 Section 1 Section 2 Section 2
2008 Jan 08
1
howto rebuild a object from a received xml hash structure ?
im my web server app , i have an action to be used as a REST web service # GET /user/membership.xml?email=emailaddress def membership @user = User.find_by_email(params[:email]) respond_to do |format| format.xml { render :xml => @user.to_xml( :only => [ :first_name, :last_name, :display_name, :membership_type, :membership_at], :skip_types => true)} end end my
2007 Nov 25
2
Rails sessions in plain text stories
Ok, maybe I''m being particularly thick, but I''ve been trying to find the solution to this for a couple of hours now and I just can''t seem to be able to do it... I''m trying to write a step as such: Given("user $email is logged in") do |email| user = User.find_by_email(email) session[:user_id] = user.id end This is the way it would
2006 Mar 22
1
How do you clean up this cryptic code?
So, I''m coding my school project in Rails. There are two models, User and Restaurants. I noticed that in Restaurants, when you use the belongs_to method, you could specify the condition of the associated table. There are a few types of users, in the user_type column of the users table - owners is type 1, users are type 2. So in my haste to hand in enough code, in the Restaurant model,
2006 Mar 27
1
polymorphism + inheritance
Hi, currently I do some work with polymorphic associations in egde rails class Order < ActiveRecord::Base belongs_to :payment, :polymorphic => true end class CreditCardPayment < Payment end class PayPalPayment < Payment end class Payment < ActiveRecord::Base has_one :order, :as => :payment # common stuff in here end I want to use [Payment] for common functionality
2006 Apr 13
2
One model won''t work like the others, generating weird error
I''ve been banging my head against this for quite some time and can''t figure out what is going on. I''m doing up a web site based on Typo and adding in some custom controllers. I''m running Typo from trunk, so it''s using the version of rails in vendor/rails. Everything is going smoothly...until now. I have one model that JUST. WON''T. WORK.