similar to: one master table to hold symbols: good or bad idea?

Displaying 20 results from an estimated 3000 matches similar to: "one master table to hold symbols: good or bad idea?"

2010 Oct 14
2
Nested form, perhaps?
I have a general design question, and haven''t written any code for this feature yet. I''m setting up a control panel for a sort of team/ content management system. A new project needs a team to work on it. The project has been saved, so we don''t have to worry about that. But each member of the team needs to have a role in relation to this project (they may have
2007 Dec 06
0
has_many :through with a has_one source
Here is my simple example... require ''rubygems'' require ''active_record'' ActiveRecord::Base.establish_connection :adapter => "sqlite3", :database => "has_many_through.db" ActiveRecord::Schema.define do create_table "containers", :force => true do |t| t.column :name, :string end create_table "shapes",
2006 Jul 10
18
Deleting join association of has_many :through
I''m trying to use has_many :through, since my join model deserves being more than just an intersection table. But when I try to break the association, the break only seems "temporary": Let''s say my two tables are Users and Colors, and the join model is Favorites. user = Users.find(1) user.colors.length >> 2 c = user.colors.first >> #<Color:....>
2010 Jun 03
2
creating fixtures for has_many :through
I''m stymied at how to create a fixture that establishes a has_many :through relationship. I''ve watched the railscast at: http://media.railscasts.com/videos/081_fixtures_in_rails_2.mov ... but that''s for HABTM relationships. I''ve read: http://www.ruby-forum.com/topic/145676 but that ultimately doesn''t answer any question. So with no further ado:
2012 Mar 22
6
rescuing ActiveRecord::RecordNotUnique: clever or ugly?
I have an ActiveRecord that has several foreign keys, where the foreign keys act as a single compound key that needs to be unique: class CreateRelations < ActiveRecord::Migration def change create_table :relations do |t| t.references :src, :null => false t.references :dst, :null => false end add_index :relations, [:src_id, :dst_id], :unique => true end end
2006 Sep 03
8
first request always fails
Hi, Whenever I restart mongrel on my production server, the first request in my browser always fails, I get this error: Processing Base#index (for 83.xx.xx.xx at 2006-09-03 16:08:47) [GET] Session ID: f1918346d193e19a70c3230286e5ce1a Parameters: {} TypeError (superclass mismatch for class Stats): /app/models/stats.rb:1 stats.rb:1 just contains a normal A/R line: class Stats <
2006 Apr 28
4
Conditional in Model
Hello ~ Is there a way to determine within a model which controller/action instantiated the model? Thx, -- Ben Reubenstein http://www.benr75.com
2007 Mar 28
5
link_to best practice
I''m looking for best practice for creating a hyperlink which has both an icon and text. I am currently using this in my view: <%= link_to image_tag(''icons/add.png'', { :align => ''absmiddle'', :border => 0, :size => ''16x16'', :alt => ''New education record'', :title => ''New education
2008 Dec 12
1
mixed model nested ANOVA
Hi, I'm working on leaf characteristics of trees. Each tree is characterised by about 10 leaf traits. The trees were sampled at 9 different locations (about 20 to 30 trees/location, NOT balanced), grouped in 3 different climatic zones (Sahelian, Soudanian and Guinean) (NOT balanced). Further, each tree is characterised by some degree of human pressure (mutilation degree), in total 4
2006 Jul 22
3
refactoring commonly used aggregations
I have a number of models that use an aggregation to combine First Name, Middle Initial and Last Name and they have been working fine. I am looking to clean this up, DRY it if possible. I have things like this in application.rb class Clwholename attr_reader :first_name, :middle_initial, :last_name def initialize(first_name, middle_initial, last_name) @first_name = first_name
2006 May 17
10
HABTM << producing incorrect insert sql ?
Greetings railsers - I''m trying to add to a collection through HABTM, but the sql insert is trying to insert a PK rather than letting mysql produce the auto_increment''ed PK. ## @medication_dose holds a validated, saved model @medication_dose.medication_frequencies << MedicationFrequency.find (:all) The above bails with, Mysql::Error: #23000Duplicate
2006 Aug 15
6
Theoretical: Should models be subclasses of AR or mix it in?
All, My apologies if this is a little long-winded and stream of consciousness-y :). SUMMARY: Why do we extend ActiveRecord instead of mixing it in to our model classes? Been thinking about my app''s models and starting to want to build something of a hierarchy. I have some commonality across 3 of my model classes and I''d liek to aggregate the behavior in a superclass.
2007 Jun 22
1
nested rest URL => passing param from select
Hi, I''m trying to create a select box with an onchange event. When onchange is fired, I want to redirect to a nested rest url. The problem is that I don''t know how to pass the selected value to the url: <select id="category" onchange=" <%= remote_function(:url => category_articles_path(selected value?) ) %> "> Any suggestions? -- Posted
2011 Jul 15
3
Ruby variable that embeds html tags
This seems very simple, but I can''t quite get it. Probably because I''m just starting out with RoR. My view has a slew of labels and text fields; many are "required": <%= f.text_field :screen_name %> <span class="required_field">Required field</span> (The "required_field" class turns the text red and smaller.) I''d like to
2006 Nov 06
21
acts_as_ferret and associations
I have the following models: class Book < ActiveRecord::Base acts_as_ferret belongs_to :author end class Author < ActiveRecord::Base has_many :books end and in the controller: def search if params[:query] @query = params[:query] @total, @books = Book.full_text_search(@query, :page => (params[:page]||1)) @pages =
2011 Jan 14
6
Server reboots unexpectebly.
Dear group, I am in the process of configuring 2 new servers. They are running Centos 5.5 and for the last three days they have been rebooting unexpectedly, can you point me in the right direction what to look for in the logs. I have been checking /var/log/messages but don't see anything that hint me any clues why this is happening. Your input is much much appreciated. Lisandro PS. These are
2006 May 26
4
What association do I want here, has_ or belongs_to?
I thought I had a handle on this one but it''s causing me grief and I''m hoping somebody can set me straight. I have an object AlertTemplate which will contain a fill in the blank style hunk of web content. I then have an object, Alert, which will have a relationship to one of those AlertTemplate objects, plus some data. So, in human speak, I''d think that an Alert
2005 Oct 11
4
Searching an attribute in a hmabtm relationship
(Nuby to Ruby and Rails...) I''ve implemented security using the login generator in a simple app so that I have a user table, a roles table, and a join between them (roles_users). All works as expected. I now need to check if a user has a specific role, but my approach is off somehow. Here''s what I''ve tried thusfar: user_roles = @session[:user].roles
2006 May 16
4
Problems with multiple ''id'' columns in a join_table
I have a problem declaring a relationship through a join_table ; the SQL generated by ActiveRecord is correct, but there are two columns called ''id'', and the final object gets the ''wrong'' column ... Here''s a more detailed description of the data, code, and problem :- There''s a People table, with id, name, and a few things. Also a
2006 Apr 08
4
saving related objects using has_many_through associations
This only saves the @person but not the @address. Shouldn''t it save both? @person = Person.new(params[:person]) @address = Address.new(params[:address]) @person.address << @address @person.save here is what I have: class Person < ActiveRecord::Base has_many :addressables has_many :addresses, :through => :addressables end class Address <