issue with mongoid and rails when do seed its faild - ruby-on-rails

first is the status:
class Status
include Mongoid::Document
field :name, type: String
has_one :Apis
validates_presence_of :name
end
as well have APIS:
class Apis
include Mongoid::Document
field :name, type: String
field :description, type: String, default: ''
field :create_at, type: DateTime, default: ->{ DateTime.now }
belongs_to :Status
validates_presence_of :name
end
the SEED file:
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
if Status.count == 0
Status.create({name: "active"})
Status.create({name: "inactive"})
Status.create({name: "pending"})
Status.create({name: "rejected"})
Status.create({name: "sending"})
Status.create({name: "contentItemPending"})
Status.create({name: "contentItemListed"})
Status.create({name: "staticItemListed"})
Status.create({name: "requestItemPending"})
end
if Apis.count == 0
active_status = Status.find_by({name:"active"})
youtub = Apis.new({name:"youtube", description:"Youtube API Used youtube_it gem"})
youtub.build_Status(active_status.id)
youtub.save!
itunes = Apis.new({name:"itunes", description:"ITUNES API Used itunes gem"})
itunes.build_Status(active_status.id)
itunes.save!
factual = Apis.new({name:"factual", description:"FACTUAL API Used FACTUAL gem"})
factual.build_Status(active_status.id)
factual.save!
end
now i get this error:
fastwings:Feelike-Agent/ (master✗) $ rake db:seed [14:21:41]
rake aborted!
uninitialized constant Statu
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:230:in `block in constantize'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:229:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/activesupport-3.2.9/lib/active_support/inflector/methods.rb:229:in `constantize'
/usr/local/rvm/gems/ruby-1.9.3-p327#global/gems/activesupport-3.2.9/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/mongoid-3.0.19/lib/mongoid/relations/metadata.rb:602:in `klass'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/mongoid-3.0.19/lib/mongoid/relations/builders.rb:68:in `block in builder'
/home/fastwings/Projects/Ruby/Feelike-Agent/db/seeds.rb:23:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/mongoid-3.0.19/lib/mongoid/railties/database.rake:13:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p327/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)
now i got no clue what i doing here wrong what is here not work???
as well its make at line 23 means
youtub.build_Status(active_status.id) to uninitialized constant Statu why???
ok Guys its work my error was this:
belongs_to :Status , class_name: 'something'
and
has_one :Apis ,class_name:'something'
and the seeder need added like this:
Mongoid.purge!
if SystemStatus.count == 0
SystemStatus.create!({name: "active"})
SystemStatus.create!({name: "inactive"})
SystemStatus.create!({name: "pending"})
SystemStatus.create!({name: "rejected"})
SystemStatus.create!({name: "sending"})
SystemStatus.create!({name: "contentItemPending"})
SystemStatus.create!({name: "contentItemListed"})
SystemStatus.create!({name: "staticItemListed"})
SystemStatus.create!({name: "requestItemPending"})
end
if Providers.count == 0
active_status = SystemStatus.find_by({name:"active"})
Providers.create!({name:"youtube", description:"Youtube API Used youtube_it gem",status: active_status})
Providers.create!({name:"itunes", description:"Youtube API Used youtube_it gem",status: active_status})
Providers.create!({name:"youtube", description:"Youtube API Used youtube_it gem",status: active_status})
Providers.create!({name:"unknown", description:"Rest service conntection",status: active_status})
end
what that went wrong here was that it didnt know what class to go to as well how i enter the data

Besides the s missing, which that's what it looks like, I'm not sure if the Status.count will even work, I think you need to use Status.all.count, and other thing is you should use Status.create! with a bang (!). It will raise an exception if if there's an error. IF you use it without the bang, it'll return false but you won't know there's a problem.

You may have to set custom inflectors for your Status model. Fire up a console and try running "status".singularize to see what you get.

Related

Rails migration is giving NoMethodError and I do not see why

I do not know why this is breaking. I'm trying to run a migration on some code I've inherited and I've hit a snag. Here is the error message followed by the migration file code.
== AddStorecreditGizmoType: migrating ========================================
rake aborted!
NoMethodError: undefined method `find_by_name' for GizmoCategory(id: integer, description: string):Class
/var/lib/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/base.rb:1876:in `method_missing'
/home/thefonso/site-dev/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:175:in `method_missing_with_paginate'
db/migrate//20090628000954_add_storecredit_gizmo_type.rb:4:in `up'
/var/lib/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/migration.rb:282:in `block in migrate'
/var/lib/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/migration.rb:282:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/migration.rb:365:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/migration.rb:457:in `run'
/var/lib/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/migration.rb:409:in `run'
/var/lib/gems/1.9.1/gems/rails-2.3.14/lib/tasks/databases.rake:135:in `block (3 levels) in <top (required)>'
/var/lib/gems/1.9.1/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate:up
(See full trace by running task with --trace)
Here is the migration file code
class AddStorecreditGizmoType < ActiveRecord::Migration
def self.up
# TODO: GizmoCategory.find_by_name("misc") is breaking...why? Attempted to replace with "where" but same error.
new = GizmoType.new(:name => "store_credit", :description => "Store Credit", :gizmo_category => GizmoCategory.find_by_name("misc"), :required_fee_cents => 0, :suggested_fee_cents => 0)
new.save!
DB.execute("UPDATE gizmo_contexts_gizmo_types SET gizmo_type_id = #{new.id} WHERE gizmo_type_id IN (SELECT id FROM gizmo_types WHERE name = 'gift_cert');")
end
def self.down
DB.execute("UPDATE gizmo_contexts_gizmo_types SET gizmo_type_id = (SELECT id FROM gizmo_types WHERE name = 'gift_cert') WHERE gizmo_type_id IN (SELECT id FROM gizmo_types WHERE name = 'store_credit');")
GizmoType.find_by_name("store_credit").destroy
end
end
I've tried using "where" and "Find_by" but I keep getting this same "undefined method blahblah for GizmoCategory
Can you point me in the right direction? What am I missing? forgetting? What's happening here?
Oh and versions are as follows
rails - 2.3.14
ruby - 1.9.3p194
Thanks
The find_by_* methods didn't exist in activerecord 2.3.14. Use Model.find instead.
category = GizmoCategory.find(:first, conditions: "name = 'store_credit'")
category.destroy if category

Rails Graphql resolve error: wrong number of arguments (given 1, expected 3)

I created fresh rails app with graphql, but had a lot of problems agains guides aged 6+ months. I suspect that graphql-ruby changing quite fast.
So my last issue in resolve method:
module Types
class QueryType < Types::BaseObject
graphql_name "Root Query"
description "The query root of this schema"
field :allProducts, [ProductType], null: false do
resolve ->(_obj, _args, _ctx) { Product.all }
end
end
end
Error:
wrong number of arguments (given 1, expected 3)
/usr/local/var/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/graphql-1.9.0.pre1/lib/graphql/schema/field.rb:430:in `resolve'
/Users/alder/Projects/_apps/service_exchange/any-do-api/app/graphql/types/query_type.rb:7:in `block in <class:QueryType>'
/usr/local/var/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/graphql-1.9.0.pre1/lib/graphql/schema/field.rb:222:in `instance_eval'
/usr/local/var/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/graphql-1.9.0.pre1/lib/graphql/schema/field.rb:222:in `initialize'
/usr/local/var/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/graphql-1.9.0.pre1/lib/graphql/schema/member/accepts_definition.rb:142:in `initialize'
/usr/local/var/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/graphql-1.9.0.pre1/lib/graphql/schema/field.rb:88:in `new'
/usr/local/var/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/graphql-1.9.0.pre1/lib/graphql/schema/field.rb:88:in `from_options'
/usr/local/var/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/graphql-1.9.0.pre1/lib/graphql/schema/member/has_fields.rb:52:in `field'
/Users/alder/Projects/_apps/service_exchange/any-do-api/app/graphql/types/query_type.rb:6:in `<class:QueryType>'
/Users/alder/Projects/_apps/service_exchange/any-do-api/app/graphql/types/query_type.rb:2:in `<module:Types>'
/Users/alder/Projects/_apps/service_exchange/any-do-api/app/graphql/types/query_type.rb:1:in `<main>'
Full log
You can check out the full project here
I'm using the latest version:
gem "graphql", "~> 1.9.0.pre1"
But the same error with 1.8.*
Ok, that resolve thing doesn't work anymore. Next code works fine:
class QueryType < Types::BaseObject
graphql_name "RootQuery"
field :categories, [Types::CategoryType], null: false
def categories
Category.all
end
end

Rails rspec shoulda matcher validating uniqueness of case insensitive item failing?

I'm trying to be a good rails developer and write tests as I go. I've run into something I'm unclear on and am looking for advice. I have a model that has a unique case insensitive attribute. The test is failing however. Whats the correct way to test this? What am I doing wrong?
class Tenant < ApplicationRecord
validates :name, presence: true
validates :name, uniqueness: { case_sensitive: false }
end
RSpec.describe Tenant, type: :model do
it { should validate_presence_of :name }
it { should validate_uniqueness_of(:name).case_insensitive }
end
It seems like it's trying to set the id as nil even though we have another validation that requires the presence. But why is it doing that while testing name? I'm confused.
Test shows the following result;
Failures:
1) Tenant Validates Uniqueness of should validate that :name is case-insensitively unique
Failure/Error: self.id = self.id.downcase
NoMethodError:
undefined method `downcase' for nil:NilClass
# ./app/models/tenant.rb:17:in `block in <class:Tenant>'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/validator.rb:96:in `perform_validation'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/validator.rb:89:in `validation_result'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/validator.rb:85:in `validation_error_messages'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/validator.rb:64:in `messages'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/validator.rb:25:in `has_messages?'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/validator.rb:55:in `messages_match?'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/validator.rb:21:in `call'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb:38:in `matches?'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb:24:in `each'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb:24:in `detect'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb:24:in `first_passing'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/allow_value_matcher.rb:533:in `public_send'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/allow_value_matcher.rb:533:in `run'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/allow_value_matcher.rb:400:in `does_not_match?'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/disallow_value_matcher.rb:32:in `matches?'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/validation_matcher.rb:155:in `run_allow_or_disallow_matcher'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_model/validation_matcher.rb:93:in `disallows_value_of'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb:606:in `validate_two_records_with_same_non_blank_value_cannot_coexist?'
# /Users/a/.rvm/gems/ruby-2.5.0/gems/shoulda-matchers-3.1.2/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb:330:in `matches?'
# ./spec/models/tenant_spec.rb:49:in `block (3 levels) in <top (required)>'
Finished in 0.09495 seconds (files took 1.89 seconds to load)
2 examples, 1 failure
Failed examples:
rspec ./spec/models/tenant_spec.rb:49 # Tenant Validates Uniqueness of should validate that :name is case-insensitively unique
Note: this is likely something dumb and obvious that I'm just missing. Your help/advice is appreciated.
Versions:
Ruby 2.50 :: Rails 5.14 :: Rspec 3.7 :: Shoulda-matcher 3.12
As nattfodd mentions:
It seems you have some before/after hooks defined. Please show more code of Tenant model class.
It was a beforehook that was the issue.

no implicit conversion of Symbol into Integer when migrating in production

So I'm working on an existing app and for some reason I was able to get it working and mirrored on my local environment however when I try migrating on heroku I get the below error, any ideas?
Error:
== 20141119113015 CreateReleasedInventoryStatus: migrating ====================
-- create_enum("eh_released_inventory_status", ["rejected", "pending", "allocated", "released", "transferred"])
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
no implicit conversion of Symbol into Integer/app/vendor/bundle/ruby/2.0.0/gems/power_enum-2.8.0/lib/power_enum/schema/schema_statements.rb:84:in `[]'
/app/vendor/bundle/ruby/2.0.0/gems/power_enum-2.8.0/lib/power_enum/schema/schema_statements.rb:84:in `create_enum'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:662:in `block in method_missing'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `block in say_with_time'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `say_with_time'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:652:in `method_missing'
/app/db/migrate/20141119113015_create_released_inventory_status.rb:3:in `change'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:606:in `exec_migration'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:589:in `block in migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection
Migration file:
class CreateReleasedInventoryStatus < ActiveRecord::Migration
def change
create_enum("eh_released_inventory_status", ["rejected", "pending", "allocated", "released", "transferred"])
end
end
I'm also using the following gem:
gem 'power_enum'
Your migration syntax seems to be incorrect for the power_enum gem that you're using.
The gem's README says the syntax uses a name, then an options hash, such as:
create_enum("status", {…})
Whereas you're using a name, then an array:
create_enum("eh_released_inventory_status", […])
As far as I can tell, the solution is to change your migration line from what you posted to the power_enum syntax. The README has a bunch of examples, and also looks like it's thorough and very well documented.
I think you migration should look like this
class CreateReleasedInventoryStatus < ActiveRecord::Migration
def change
create_enum :released_inventory_status, name_column: :status, description: true, name_limit: 5
["rejected", "pending", "allocated", "released", "transferred"].each do |status|
ReleasedInventoryStatus.update_enumerations_model do |klass|
#0.8.1 < version < 0.9.3 does not yield the klass
#in this case use:
#ReleasedInventoryStatus.create
#in place of klass.create
klass.create :name => status,
:description => status.capitalize
end
end
end
end
This will create the table released_inventory_statuses with status and description columns with a limit of 5 unique statuses. Then it will populate status and description for each item in you list through update_enumeration_model. This should work for your use case but I have not tested this theory. My answer is purely based on how create_enum works and then this section of the README
update_enumerations_model (since version 0.8.1)
The preferred mechanism to update an enumerations model in migrations and similar. Pass in a block to this method to to perform any updates.

rails3 - uninitialized constant in factory definition

factory_girl is not recognizing a model name that I've defined, and which I need to reference because I need a subclass. This worked in rails 2 but I'm migrating to rails 3.
Factory definition:
Factory.define :interest, :class => Term::Interest do |f|
f.name {"#{Factory.next(:lipsum_word)}ing"}
end
Definition of Term and Term::Interest
class Term < ActiveRecord::Base
belongs_to :category
class Interest < Term
end
class Award < Term
end
end
Error and stack trace:
$ rake db:data:load --trace
(in /Users/glurban/code/recruitd)
rake aborted!
uninitialized constant Term
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/rspec-core-2.4.0/lib/rspec/core/backward_compatibility.rb:20:in `const_missing'
/Users/glurban/code/recruitd/test/factories/factories.rb:316:in `<top (required)>'
/Users/glurban/code/recruitd/lib/tasks/use_factories.rake:2:in `<top (required)>'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/railties-3.0.0/lib/rails/engine.rb:131:in `block in load_tasks'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/railties-3.0.0/lib/rails/engine.rb:131:in `each'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/railties-3.0.0/lib/rails/engine.rb:131:in `load_tasks'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/railties-3.0.0/lib/rails/application.rb:141:in `load_tasks'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/railties-3.0.0/lib/rails/application.rb:77:in `method_missing'
/Users/glurban/code/recruitd/Rakefile:7:in `<top (required)>'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2017:in `block in load_rakefile'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2000:in `block in run'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/bin/rake:19:in `load'
/Users/glurban/.rvm/gems/ruby-1.9.2-rc2/bin/rake:19:in `<main>'
I tried adding require_dependency 'term' to the top of factories.rb but then I get
Glens-MacBook-Pro:test glurban$ rake db:data:load
(in /Users/glurban/code/recruitd)
rake aborted!
No such file to load -- term
What to do?
Edit: in response to the comment, yes, it happens only on rake, not in the console:
$ rails c
Loading development environment (Rails 3.0.0)
ruby-1.9.2-rc2 > Factory(:term)
=> #<Term id: 3, type: nil, name: "Proud to be a Recruitd user", location: nil, category_id: nil, description: nil, url: nil, created_at: "2011-01-06 21:30:14", updated_at: "2011-01-06 21:30:14">
ruby-1.9.2-rc2 > Factory(:interest)
=> #<Term::Interest id: 4, type: "Term::Interest", name: "siting", location: nil, category_id: nil, description: nil, url: nil, created_at: "2011-01-06 21:30:18", updated_at: "2011-01-06 21:30:18">
Custom rake task definition:
require 'factory_girl'
require File.expand_path("test/factories/factories.rb")
namespace :db do
namespace :data do
desc "Load sample data"
task :load => :environment do |t|
create_students
...
create_student_files_and_feeds
puts "Completed loading sample data."
end
end
end
def create_interests
data_fetch("interests").each do |input|
Factory(:interest, :name => input.strip)
end
puts "Created interests"
end
After looking over the factory_girl documentation again, I realized that you can specify a class using either a string or a class constant. So I tried using a string and it worked:
Factory.define :interest, :class => "Term::Interest" do |f|
f.name {"#{Factory.next(:lipsum_word)}ing"}
end
Also, a comment about the nested classes. I initially did that to keep the classes a little more organized, but given the complexity it's created (especially for routing), I'm just going to move each subclass to its own model file. (If I were to un-nest them without putting them in separate files, rails seems to fail to find the subclasses sometimes--namely if the parent class hadn't been referenced (forcing the load of that file) before.

Resources