search for: type_code

Displaying 4 results from an estimated 4 matches for "type_code".

2006 Mar 29
3
Loading records during class definition
...my database that currently has 4 rows. I want to access these as constants in the application because that''s effectively what they are. I tried this... class StockRuleLevel < ActiveRecord::Base has_many :stock_rules SITE = find(:first, :conditions => "type_code = ''site''").id MAKE = find(:first, :conditions => "type_code = ''make''").id MODEL = find(:first, :conditions => "type_code = ''model''").id DERIVATIVE = find(:first, :conditions => &quot...
2006 Mar 19
3
Can''t add data during migration if column is called "type"
Hi I''m new to Rails. This is my first application and I''m trying to set up a schema I''ve hand-crafted as a migration. Does anybody know why this... # deposit_types create_table :deposit_types do |table| table.column :type_code, :string, :limit => 20, :null => false table.column :description, :string, :limit => 50, :null => false end add_index :deposit_types, :type_code, :unique add_index :deposit_types, :description, :unique [ ["pc_of_tcp", "percentage of total cash...
2006 Apr 22
6
STI and type tables?
So by default to get STI, I would have something like: create_table :items do |t| t.column "type", :string t.column "title", :string end But if I want to store those type values in a separate table, such that I have ... create_table :items do |t| t.column "item_type_id", :string t.column "title", :string
2007 Jul 01
0
rake: uninitialized const ActionController::TestUploadedFile
Hi, My app uses attachment_fu and I''d like to pre-load some data via a rake task. Thus: [code]desc "Upload template files" task :upload_files_test => :environment do |t| conf = Conference.find(1) [{:f => ''styles.css'', :type_code => ''css'', :content_type => ''text/css''}].each do |i| file = ActionController::TestUploadedFile.new("db/migrate/widgets_layout/" + i[:f], i[:content_type]) conf.conference_files.create(:uploaded_data => file) end end[/code] But I get t...