Ruby on Rails Thursday, June 30, 2016

I have

app/controllers/admin/post_categories_controller.rb
app
/models/post_category
app
/test/controllers/admin/post_categories_controller_test.rb

When I run

rake test app/test/controllers/admin/post_categories_controller.rb`


I get errors like:

  1) Error:
PostCategoryTest#test_should_not_save_post_category_without_title:
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "admin_post_categories" does not exist
LINE 1: DELETE FROM "admin_post_categories"

Here's part of my `post_categories_controller_test.rb`:

require 'test_helper'

class Admin::PostCategoriesControllerTest < ActionController::TestCase
  setup do
    @post_category = post_categories(:one)
  end

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:post_categories)
  end

  test "should get new" do
    get :new
    assert_response :success
  end

So, basically my problem is that controllers, views and other things are namespaced (for now there is an "admin" namespace, but I will also add a "public" namespace later), but I want to use the same models (not namespaced models) for both the admin and the public area of this system.

Thanks in advance for any help.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/80fbe9cc-f6fd-498c-a199-75c2e834e0cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment