similar to: DRY in Models

Displaying 20 results from an estimated 8000 matches similar to: "DRY in Models"

2006 Jan 20
11
HABTM relations
Hi, I have 3 tables with HABTM relation. USERS -> QUOTE_TO_USER <- QUOTES Table QUOTE_TO_USER has 3 attributes: quote_id, user_id, component. I have a form where I can tie multiple users to QUOTE. This is easy one, thru "user_ids" (@quote[:user_ids] = @params[:quote][:user_ids]). In this form I have all users and I just check those I want to tie to this quote, however
2006 Mar 31
6
Split Validations?
I have a single table that two people enter data into. Person A creates the record and I need to specify certain required fields in his form. Person B has a separate form and she fills in additional fields and I need to specify that some of these are required. Since the data is all in one table and since the validations are in the model, won''t Rails complain when person A tries to
2005 Dec 17
1
lost in an ActiveRecord::StatementInvalid
I have an error I don''t know how to debug. I am adding the login suport in Depot (the example in the RoR book) and LoginController#add_user throws ActiveRecord::StatementInvalid in an innocent /login/add_user GET request. The trace goes down to a call to SQLiteAdapter#table_structure, and the source code suggests what''s happening is that "PRAGMA
2006 Feb 15
8
Agile book - getting confusing error
Working through the beginning phase from the Agile book on ''Administration'' undefined method `hashed_password='' for #<User:0xb7911324> ... /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1498:in `method_missing'' #{RAILS_ROOT}/app/models/user.rb:12:in `before_create''
2007 Dec 31
1
Agile Web Dev w/Rails - Password Change
Happy New Year everyone. Just wondering if anyone has coded the ability to allow a user to change their password following the way the book (second edition) implements administration. Seems like I should be able to cut out the password/password_confirmation portion of ''add_user'' form to create a ''change_pass'' form. The problem is I''m not sure how to go
2006 Jan 30
4
Is this a case for STI?
Hi everyone, We have different populations of people here at our college: Staff, Faculty, Students, Alumni (and a host of "Other" that I''ll worry about another day. I originally had only Staff and Faculty loaded in under a Person model using a Personnel controller. Now I want to add the students in, so I thought STI might be the way to go: class Person < AR::Base end
2006 Apr 17
15
Version 1.1.2 CHM Documentation File
I finally got around to compiling the Rails 1.1.2 Documentation into a CHM file this morning. You can download the file directly from here: http://delynnberry.com/files/rails-documentation-1-1-2.chm. Let me know if you encounter any problems with the file. -- DeLynn Berry delynn@gmail.com http://delynnberry.com
2006 Feb 07
13
CHM Documentation for Rails Version 1.0
Just wanted to let everyone know that I just posted an updated CHM file that contains documentation for Rails Version 1.0. You can read all about it here<http://www.delynnberry.com/articles/2006/02/07/rails-chm-documentation-version-1-0>. I plan to continue updating the CHM file as newer versions of Rails are announced, but I also want to finish an article that includes a rake file that will
2006 Nov 24
14
CHM Documentation for Rails 1.2.0 - RC1
Since the first release candidate of Rails 1.2.0 was announced yesterday, I decided to update my CHM documentation file for this release. You can find the updated file via my CHM Documentation Project Page [1], or you can download the file directly from here: http://delynnberry.com/assets/2006/11/24/rails-documentation-1-2-0-pre-release.chm. [1] -
2006 Oct 16
6
Rails CHM Documentation - 1.1.6
Just a quick email to let those interested know that I''ve posted an updated version of my CHM document that now has all the documentation from the 1.1.6 release of Rails. You can read more about it here: http://delynnberry.com/2006/10/16/rails-chm-documentation-version-1-1-6 I''m also planning on creating a pre-release version based on what is currently available in Rails trunk.
2006 Feb 19
8
select, first option empty value?
using the below: <%= select(''project'', ''project_type_id'', @project_types.collect {|x| [x.name,x.id]}, {:include_blank => true}) %> but i''d like that first option to have something like "select project type" with an empty value?
2006 May 30
16
Is Rails a good place to start for a newb to the database
Is Rails a good place to start for a newb to the database world ?? I need to make a database that is searchable with multiple filters that can be turned on and off at a moments notice kinda like java xhtml dynamic loading.. I have not worked with php or mysql much more than basic scripts running and website defaults. so I am new to the racket and want to pick something that is robust and
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 Mar 07
4
Controllers More Than One Sub-Directory Deep?
Does anyone know how to make Rails aware of controllers that might exist in directories that exist deeper than one level under the app/controllers directory? I initially figured just adding additional scope information might do the trik (i.e. Tabs::Admin::OneController or Admin::Tabs::OneController), but that does not seem to work. I''m guessing that I can just manually add these
2006 Jun 02
4
Web app developed in WInXP want to run on Linux
Hi All, I have developed a web application using RoR on Window-XP. Now my server is on linux and want to get this running on linux machine. I tried starting the server but it failed to boot in boot.rb at this line: unless RUBY_PLATFORM =~ /mswin32/ require ''pathname'' root_path = Pathname.new(root_path).cleanpath(true).to_s end so I changed(even though the file says
2006 Jan 20
11
Userstamp Plugin
I''m pleased to announce a new plugin for Rails: Userstamp. You can read my blog post at http://www.delynnberry.com/articles/2006/01/20/userstamp-plugin and/or read all about it at the perminant page http://www.delynnberry.com/pages/userstamp. Any comments or suggestions for improvement are much appreciated. -- DeLynn Berry delynn@gmail.com http://www.delynnberry.com A dump of the Readme
2006 Jul 06
5
Single table inheritance
I''m having a class called Person, with subclasses as goalkeeper, forward, defender. Now a person can be a forward as well as a defender or a goalkeeper. I want to use single table inheritance like : class Goalkeepr < Person end And not have multiple boolean columns like in my people table like is is_goalkpeer, is_forward, is_defender. How do I go about it ? Thanks, Pratik -- rm
2005 Dec 30
6
Suggestion for New User
I, like many people, am starting to learn Ruby because of Rails. I am going through several tutorials and am understanding the concepts without too much difficulty, but the one area I am having trouble with is learning the new language. I am not a trained programmer. Rather, I learned how to program out of necessity and therefore lack some of the background that many of you have. I am
2005 Aug 10
5
validates_format_of on an optional field using :if
Hi there, I''ve got the following in my model: validates_format_of :postcode, :with => /^([a-zA-Z]{1,2}[0-9]{1,2} [0-9]{1}[a-zA-Z]{2})$/, :message => "is not valid", :if => :postcode ... but it''s not working - it always insists on validation, even if postcode is empty. Basically, the postcode field is optional, but if it''s filled in, I want to
2006 Jul 02
7
Generic SingleTable inheritance
Hi all, I would like to discuss a design idea I have in mind with you, in order to get critical feedback. ActiveRecord supports single table inheritance(STI) "per se", BUT you must add all possible instance variables(properties) of all subclasses to the "base table"(as columns). I would like to circumvent this restriction. Say we have a class AbstractGenericThing <