Symfony "cannot fetch TableMap" error when using propel:build-all - symfony1

Cannot fetch TableMap for undefined table: order_product. Make sure you have the static MapBuilder registration code after your peer stub class definition.
Even if I erase the entire schema, clear the cache, and delete everything but "vendor" in the lib folder, I still get the error. I also get the error when doing propel:build-filters or propel:build-forms.
Thanks for your help in advance!

Turns out I had defined a class with the same name as one of the models. Whoops.

Related

Monkey patching a db model class in Rails with Mongoid causes weird behaviour

I am using a development script file to check out new possible ideas. Recently I tried to monkey patch MyDBObject from within that script file.
Assume an empty dev.rb file and add a monkey patch right in the top like so:
class MyDBObject
def test_function
'function works'
end
end
Starting up the pry console and loading the file yields random results.
First I received:
NoMethodError: undefined method `relations' for MyDBObject:Class
Later the script loaded, but I couldn't access the original class any longer:
undefined method `first' for MyDBObject:Class
I noticed that prepending the line:
MyDBObject
right before the monkey patching, the intended functionality is achieved.
This appears to be some sort of lazy loading of the class objects. Can somebody cast some light on this for me please?
Depending on the order in which source files are loaded, you'll either be redefining the entire class, or having your changes replaced.
I highly recommend giving this a read: http://www.justinweiss.com/articles/3-ways-to-monkey-patch-without-making-a-mess/ (TLDR - put your patch in a module and explicitly include it)

Fitnesse: Could not find or load main class

When I run a test I get the below error:
Error: Could not find or load main class C:\GrowthEdition.QA\fitnesse\fitSharp\Runner.exe
The runner is in the specified location.
In the suitesetup I have defined the test runner:
variable defined: TEST_RUNNER=C:\GrowthEdition.QA\fitnesse\fitSharp\Runner.exe
What could be causing this issue, and how can I resolve it?
Many Thanks,
Rahul Dixit
please ignore.
I dont, know what I did differently, but it suddenly started working again.

One of my Mongoid models has forgotten that is a database object

So I have this model object Shop::Order, which has worked fine until now.
But today I get these weird errors in my forms Undefined method 'model_name' for Shop::Order:Class.
So I look around and test in my console, that all instances of Shop::Order don't have any persistence methods. But still my tests don't fail. So I load up the test console and there Shop::Order works perfectly.
This doesn't really make any sense to me and I'm quite frankly out of Ideas on how to solve this.
Here's a link to the model: Shop::Order
The error appears in this view: new.html.haml
All other models are working totally fine.
Any help would be appreciated.
The problem lays in config/initializers/contants.rb where you're predefining your Shop::Order class.
I assume what happens is, the autoloader does not search further once it already has the class defined.
You should remove it, as this is not the initializer use case to define model's constants.

'table_structor': Could not find table 'views'

I'm trying to use rails_admin for the first time and I'm getting the following error during installation:
'table_structor': Could not find table 'views'
I've never had a model named 'views', so I'm not even sure why it's looking for this. Any ideas what may be causing this?
Check your models folder. You probably have a rouge model you aren't using.

Actsaswizard Rails Plugin

I'm having a problem implementing the example in the actaswizard readme, and I was wondering if my error would be obvious to anyone here.
My controllers, models, and migrations are exactly as shown here: https://github.com/adkron/actsaswizard
My routes are as follows:
match 'test' => 'employees#new'
resources :employees
However when I navigate to localhost/test I recieve the following error:
NoMethodError (undefined method state' for #<Employee:0x00000001c22ad0>):
app/controllers/employees_controller.rb:10:inedit'
Does anyone recognize this error, or have any advice on how to get around it? Thanks in advance for any help! In addition, if you know of any good guides or additional examples using this plugin I'd be grateful for them as well.
I think that the actsaswizard uses the AASM (acts as state machine) to navigate you through the steps. That is why you need to specify a field "state" for the model that actsaswizard! This means that you must run a migration that makes a column named state of string type. Let me know if that worked!

Resources