similar to: Data modeling - representing data across models

Displaying 20 results from an estimated 7000 matches similar to: "Data modeling - representing data across models"

2006 Apr 20
3
has_many :through with has_many/has_many join models
It seems that using a join model that joins with two has_many''s will fail to generate proper SQL class StudentSemesterRecord < ActiveRecord::Base belongs_to :semester has_many :discipline_records, :through => :semester end class Semester < ActiveRecord::Base has_many :student_semester_records has_many :discipline_records end class DisciplineRecord <
2006 Apr 29
1
Warnings printed to console causes error if console closed on Linux
I had a statement that was generating a warning about parenthesise argument for future version. The interesting thing was it would crash the page with an input/output error on my production linux server, but worked fine in webbrick/windows. I finally tracked it down to it crashed when trying to print the warning to the console. If I kept the terminal open that I started the server on it would
2006 Feb 16
5
Firefox and IE performance with Rails App
In my rails application, certain computers were having huge problems. There were certain pages that were exceptionally slow, even to the point of timing out. Other computers did not have a problem. I finally found that Firefox was the difference. When using Firefox on those computers it works fine. The slow pages were typically posting a form with a couple hundred fields. This behavior was
2006 Jul 17
1
How to DRY up validates_presence_of
Given the case of validating the presence of an attribute and then performing other tests on said attribute, how do you go about not having to check for nil in the other tests? Example: validates_presence_of :start_date, :end_date validate :validate_start_date_before_end_date def validate_start_date_before_end_date # without this check an exception will be thrown on access to the
2006 Apr 20
1
has_many.count not accepting options hash
has_many.count does not seem to support an options hash like ActiveRecord::Base.count does. Example: >> AcademicProgram.find(:first).course_requirements.count :conditions => "courses.name LIKE ''a%''", :include => :course => 40 >> ap.ap_requirements.count :conditions => "courses.name LIKE ''a%''", :include =>
2006 Aug 10
1
Customizing log output
I''d like to include the user name along with/instead of the session id in my log files. Is there a place to customize the log format, or do I just need to through the logger object and manually write it in a before_filter on my ApplicationController? Thanks. -- Jack Christensen jackc@hylesanderson.edu
2006 Aug 10
4
Speeding up ActiveRecord creation?
My completely empty model (no validation callbacks etc etc) takes an average of 0.05 seconds to create, at least according to Benchmark.realtime{200.times{Message.create(:from => "me@here.com", :message_type => ''email'', :subject => "hello", :body => "goodbye", :sent_at => Time.now)}}/200 That''s a little slower than
2005 Dec 29
0
observe_form without an update parameter
I''m using observe_form in a place that does not require any response from the server. So I do not use an update paramater. But without it webbrick hangs for a couple seconds and returns a status 500. On occasion, there will even be an exception in webbrick''s output if I change the form then quickly click a link before the couple second hang is done. If a add an update, it
2005 Jul 28
0
ActiveRecord, computed values, and associations
Is there some sort of good pattern for dealing with computed values with Rails/ActiveRecord? A simple example: 3 tables, classes, students, and student_class_records (habtm style relation but contains a good deal of additional state so is modeled explicitly) Something like select the 10 classes with the most students. Easy enough in SQL. So I''m using a lot of find_by_sql and
2006 Feb 21
8
pdf generators
Hi Folks, Could you please comment on various PDF generators that one may use. Thanks. Lalit Send instant messages to your online friends http://au.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060221/8b319788/attachment.html
2006 Feb 03
6
Go back to previous action
Hello all! I have two views (list_1 and list_2) that show a list of users in two different ways. In the views for these actions there is a link to edit a specific user properties (edit_user). That works fine, except that when I change the user I want to go back to the view that originated the request and not to the default list (list_1). Can anyone help me? Best regards, Hugo -- Posted via
2006 May 23
8
ad-hoc query
How do you run an ad-hoc query that does not belong in any model? I thought it was something like ActiveRecord::connection.find("my query..."), but I can''t seem to find the documentation on it. I know I''ve seen it somewhere before, though. thanks, Jeff -- Posted via http://www.ruby-forum.com/.
2006 Jul 06
6
Class variables in templates/layouts
I''m having problems with class variables.. I have a class: class Content::ApplicantsController < ApplicationController layout "mylayout" @@tab = "mystring" [... the rest is standard scaffold-created stuff ...] and a layout (mylayout.rhtml): [...] <title><%= @@tab.capitalize %></title> [...] And I keep getting this error: uninitialized
2007 Jun 05
4
uninitialized constant RailsHandler::Dispatcher
Hello, I am running in to an error trying to run mongrel. The server starts but then trying to access any url in my application throws this error: calling Dispatcher.dispatch uninitialized constant RailsHandler::Dispatcher ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:477:in `const_missing''
2006 Jul 28
1
Nasty pitfall: don''t use ^ and $ in validation regexes!
Let''s say you want to validate that an attribute contains only 2-10 lowercase characters, e.g. with validates_format_of. The appropriate regex is obviously /^[a-z]{2,10}$/, right? Wrong! Try it with "abc\nANYTHING YOU LIKE" - this is perfectly valid. On the second look the reason is clear: ^ matches the start of a line, $ matches the end of a line. So as long as one line in
2006 May 09
2
Bulk Inserts. Fast way to insert 1000s records?
Hi, This code loops through my results and saves them : @results.each{|r| r.save} There are potentially thousands of results. This takes ages to complete. Is there a quicker way to do this? Any help is greately appreciated Thanks Chris -- Posted via http://www.ruby-forum.com/.
2006 Jun 05
5
Controller-wide instance variable
Is it possible to declare an instance variable in a controller that is available to every action without defining the variable in every action? -- Posted via http://www.ruby-forum.com/.
2006 Aug 01
2
HOWTO? security based on data values
Hi! I recently started with RoR and this may be a newbie question. I have a company table, employee table and transactions table. 1 company has many employees. Each employee performs many transactions. Employees from different companies LOGIN to the system to record their transactions. Employees can search on all transactions associated to their companies (indirect relationship via employee),
2002 Mar 27
2
Problem with ssh-keygen
Dear Developer, I'm having problem running ssh_keygen on my solaris 7 box. Can you please tell me as to why I'm getting this error as described below? I don't have that problem with solaris 8 that runs SMCossh 3.0.2p1 Thanks in advance. Louie # /usr/local/bin/ssh-keygen ld.so.1: /usr/local/bin/ssh-keygen: fatal: libcrypto.so.0.9.6: open failed: No such file or directory Killed #
2006 Jul 28
3
Forms: handle foreign keys (AssociationTypeMismatch)
Hi all I tried and tried and tried, but I still fail in creating a form with proper validation and stuff for foreign keys... So I''d really like to get some help here. I''m creating a booking site for DJ''s, and for every booking one can choose one of different countries: class Booking < ActiveRecord::Base validates_presence_of :country_id