This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CreateInterfaces < ActiveRecord::Migration | |
| def self.up | |
| create_table :interfaces do |t| | |
| t.string :name | |
| t.string :description | |
| t.timestamps | |
| end | |
| end | |
| def self.down |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Asset < ActiveRecord::Base | |
| has_many :service_assignments | |
| has_many :services, :through => :service_assignments | |
| has_many :functions, :through => :services | |
| has_many :clusters, :through => :services | |
| end | |
| class ServiceAssignment < ActiveRecord::Base | |
| belongs_to :asset | |
| belongs_to :service |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >> Asset.first.functions | |
| Hirb Error: Mysql::Error: Unknown column 'services.asset_id' in 'where clause': SELECT `functions`.* FROM `functions` INNER JOIN `services` ON `functions`.id = `services`.function_id WHERE ((`services`.asset_id = 1)) ORDER BY name ASC | |
| vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `log' | |
| vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:323:in `execute' | |
| vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:608:in `select' | |
| vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache' | |
| vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all' | |
| vendor/rails/activerecord/lib/active_record/base.rb:661:in `find_by_sql' | |
| vendor/rails/activerecord/lib/active_record/base.rb:1548:in `find_every' | |
| vendor/rails/activerecord/lib/active_record/base |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ script/console | |
| Loading development environment (Rails 2.3.2) | |
| >> User.find(7) | |
| => #<User id: 7, login: "testuser", crypted_password: "...", password_salt: "...", persistence_token: "...", login_count: 9, last_request_at: "2009-08-19 10:45:25", last_login_at: "2009-08-18 00:05:27", current_login_at: "2009-08-19 08:12:31", last_login_ip: "10.140.204.86", current_login_ip: "10.140.204.86", created_at: "2009-03-27 17:57:44", updated_at: "2009-08-19 10:45:25", customer_id: 1, perishable_token: "...", email: "[email protected]"> | |
| >> Project.find(1) | |
| => #<Project id: 1, customer_id: 1, name: "Test Project #1", created_at: "2009-08-19 04:04:04", updated_at: "2009-08-19 04:04:04"> | |
| >> User.find(7).projects | |
| => [#<Project id: 1, customer_id: 1, name: "Test Project #1", created_at: "2009-04-16 09:15:43", updated_at: "2009-04-16 09:15:48">] | |
| >> Project.find(1).users | |
| => [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create_table "externalusers", :force => true do |t| | |
| t.string "login" | |
| t.string "crypted_password" | |
| t.string "password_salt" | |
| t.string "persistence_token" | |
| t.integer "login_count" | |
| t.datetime "last_request_at" | |
| t.datetime "last_login_at" | |
| t.datetime "current_login_at" | |
| t.string "last_login_ip" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Project < ActiveRecord::Base | |
| has_and_belongs_to_many :users | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User < ActiveRecord::Base | |
| set_table_name "externalusers" | |
| has_and_belongs_to_many :projects | |
| end |
NewerOlder