similar to: Module and model names

Displaying 20 results from an estimated 100000 matches similar to: "Module and model names"

2005 Nov 24
0
model classes into module = superclass mismatch
Hello. I''d like to put all my data model classes into a module to avoid name clashes with other classes. However, when I do so, I get a superclass mismatch error. My class hierarchy for the class in question looks like this: class ViewCTI < ActiveRecord::Base end module ORM class Molecule < ViewCTI end end I load the model classes from the ApplicationController class
2006 Dec 21
5
Advice with Model tests
Hi! I''m developing a rails applicaton with specify-before approach, with nice results so far. I use mocks and stubs in both Controller and views tests, but the main issue is with model testing. Since I''ve seen many examples here and there, I don''t know if the right way is to use fixtures or not at all (in model specs). Atm, I''m using them, but I
2007 Aug 27
2
Testing arbitrary SQL
Hi, I would like to know how would you test a method in a model that uses complex a SQL query that joins several tables in order to make a calculation. I suppose that I need fixtures, although my approach with rspec is to avoid fixtures and isolate model specs, but none of both seems possible in this case. Is there another way than fixtures? Thanks.
2006 Nov 11
0
Error when creating a new worker -- "Text is not a module - (TypeError)"
Hello everyone, I''m stuck with this very obscure error whenever I try to create a new worker. My worker is a subclass of BackgrounDRb::Worker::RailsBase, and if you follow the stack trace below, you can tell that the error occurs while trying to load Rails. There is no problem starting up the server, by the way. Does anyone have any idea what might be causing this? I didn''t have
2006 Feb 09
0
Extending ActiveRecord creates TypeError
Hi. I have want to use the following arrangement: Model < CustomClass < ActiveRecord::Base My CustomClass has a bunch of code I want to be held in common to all my models. What happens however is that if I access a controller that uses Model, it works. Then on the second view (hitting reload) I always get: TypeError (superclass mismatch for class User):
2007 Jan 17
0
Models and Modules and subclassing, oh my!
So, our application has a large number of models at this point, and I''m getting a bit worried about people having to use long names, as well as clashes in the global namespace. More recently I wanted to add a new table with some STI subclasses of that table... module Portal end class Portal::Base < ActiveRecord::Base belongs_to :widget end However, Widget is a top level class,
2006 Jun 23
0
Overriding a file_column attribute in model
I have a user model subclassed into Employees and Managers using STI. I am using FileColumn to manage images, in this case logos. If an Employee doesn''t have a logo of its own, I want my app to use the Manager''s logo in views. I did the following in models/users.rb: ------- class User < ActiveRecord::Base file_column :logo end class Employee < User belongs_to
2008 Jan 23
2
Accessing the current session
I''m trying to fetch a session (and other fb user variables from the session) at the start of my controller, so that all the actions in that controller can make use of it. Here''s the code: class FacebookController < ApplicationController ensure_application_is_installed_by_facebook_user fb_session = session[:facebook_session] # ... action functions here ... end
2006 Nov 16
1
Strange indexing issues with CachedModel, STI, and AAF
I started using robotcoop''s CachedModel class in my project but have encountered problems when using it with the acts_as_ferret plugin. It seems it doesn''t index everything in my STI model, also if I do a search from my base STI class I get a result count but no results. If I run the same search from one of the children STI models I get the appropriate results (if the information
2006 May 28
1
Changing module name - help!
When I started developing my application I grouped my controllers in the followin g fashion: User::ControllerName. Now I''ve realized that the ''User'' module is a misnomer for my current controllers and I need to use the User module for something else, so I decided to change the controllers in the ''User'' module to ''Data''.
2013 Sep 30
0
TypeError: no implicit conversion of Symbol into Hash when submitting form to upload files
I''m currently new to Rails and Ruby and I''m trying to learn from my mistakes, this time I''m trying to upload 2 files from a form for later processing, however, after I hit the "Submit" button. I keep getting this error: TypeError in UploadFilesController#create app/controllers/upload_files_controller.rb:28:in `new''
2005 Dec 08
1
Test is not a module (TypeError)
Hi, We have a project with a db table ''test'' and a corresponding model Test. When we run rake to invoke our tests, rake fails with the following error: /usr/lib/ruby/1.8/test/unit/assertionfailederror.rb:5: Test is not a module (TypeError) We believe this is caused by some namespace conflict between our model named Test and rake''s own internals. If we rename our
2012 Jan 24
2
Cipher is not a module
Hi, I''m trying to install puppet as a client on a new machine. I received this weird error when trying to start up as /etc/init.d/ puppet start : /usr/lib/ruby/1.8/openssl/cipher.rb:22: Cipher is not a module (TypeError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 36:in `gem_original_require'' from
2006 Jul 26
0
Model named Application
I have a database table named applications which (in Rails convention) produces model named Application in file app/models/application.rb. The application.rb file doesn''t seem to be loaded as I get a ''const_missing'' error when trying to access it. If I handcraft the class within script/console, everything works fine. Is there something in the Rails loader that
2005 Nov 09
3
AJAX form Parameters jumbled.
Sorry for the repost but I originally posted this as a response to another thread. I have a text field called ''phrase'' but the parameter values always come up as nil and when I check the parameters dumped in the error message I do not get the normal hash you''d expect. Instead of something like {"phrase"=>"jim"} I get:
2011 Apr 15
2
sti + namespace
I''m spidering historical weather data from various sources. I have a WeatherStation class that is begging for an STI implementation: a WeatherStation is associated with a specific weather service, and each weather service has its own protocol for fetching weather data, but most of the code is can be shared in the WeatherStation parent class. Ergo STI. But there are a lot of weather
2006 Jun 23
1
Rate is not a class
Here''s one I haven''t seen before I have a model "section.rb" as follows: class Section < ActiveRecord::Base ###Lot of common stuff end class Normal < Section end class Faq < Section has_many :faq_categories, :order => :position end class Rate < Section has_many :rate_tables end Now I''ve just added the Rates class and it works just
2006 Jun 18
2
Why can''t I use a session? (Symbol as array index)
Hi All I can''t for the life of me see what is wrong with this. Maybe it''s cause it''s midnight... I want to put some data in a session and I have some code like this: class ApplicationController < ActionController::Base model :mything def ApplicationController.chosen_thing session[:chosen_thing] ||= MyThing.defaultThing end end So whenever I try to
2006 Jul 25
2
Model relationship confusion ...
Hi all, I''m thinking this must be pretty straightforward, but I''m finding myself kind of going in circles in trying to model a simple "private messaging" app. I have two models: user and message User has many messages Message has a sender (User) has many recipients (Users) I''m at a bit of a loss as to how best define the relationships that occur in
2006 Oct 22
1
Rails association and multiple indexes
Hi! If I have two models, Product and Manufacturer, of course Product belongs_to :manufacturer. A search engine would allow a user to look for a product by its name or manufacturer. Is it better to define a method like: def searchable_field "#{name} #{manufacturer.name}" end and add it as indexable field (acts_as_ferret :fields =>