similar to: One Controller, Many models

Displaying 20 results from an estimated 700 matches similar to: "One Controller, Many models"

2006 Nov 30
3
model stubs with view/controller specs: error_messages_for??
How would I set up a model stub so that <%= error_messages_for ''some_model'' %> doesn''t complain? I started going down this road: @some_model.stub! (:errors).and_return(ActiveRecord::Errors.new) but it seems like a long, hopefully uneccessary road. Cheers, Michael
2006 Apr 26
6
Immediate help needed
I have posted this previously also but haven''t received any help. So, if somebody could look into it and guide.. I want to validate the extension of files that I am uploading. Like I want only the doc/pdf files to be uploaded.. Thanks in advance. -- Posted via http://www.ruby-forum.com/.
2008 Jul 02
2
How to write the method before_destroy and the test
How to write the method before_destroy? Here is my code: def before_destroy errors.add(:isdefault,"Can''t destroy default record") if self.isdefault return false end or I should write it like below? def before_destroy raise(Can''t destroy default record") if self.isdefault end and how to write the test for it -- Posted via
2011 Apr 27
2
2.0.12 Coredump under Solaris 10
hi, I've installed a testversion from 2.0.12 and getting coredumps after login via IMAP/POP3. I don't know, if it is a simple config error or something else. ====== dovecot: [ID 583609 local7.error] master: Error: service(imap): child 29333 killed with signal 11 (core dumped) [ID 583609 local7.error] master: Error: service(imap): child 29335 killed with signal 11 (core dumped) ======
2006 Feb 15
2
extending rails via /lib - problems
I wanted to group some functions which I use in some models in one place. Controllers have application.rb and views have helpers but I couldn''t find anything about models. Using the /lib directory seemed to be the only way. Alright... so I have something like this: /lib/code.rb class ActiveRecord::Base def method_a(n) ....... end def method_b(n) ........ end end
2006 Apr 03
4
STI Broken on 1.1
Yeah I''m getting major problems as well. I don''t know what the issue is but I''m thinking of going back to 1.0 I would really like to hear if you figure this out, kind of an important part of Rails for us. -Paul -------------- next part -------------- An HTML attachment was scrubbed... URL:
2006 Jun 05
2
Class Table Inheritance implementation
I know that Rails uses the Single-Table Inheritance as mentioned in the wiki (http://wiki.rubyonrails.com/rails/pages/SingleTableInheritance). I was wondering if there was an easy way of implementing Class Table Inheritance easily (one table per class) as defined in http://www.martinfowler.com/eaaCatalog/classTableInheritance.html. The model that I am used to is Class Table Inheritance, and
2006 Mar 14
4
Two Customer Types - Best Design Principle?
Hi all, I''ll do my best to explain this... I have the possibility to have two customer types in my system: 1. A "mailing list" type: new records are saved when user enters email address in the mailing list subscription form. 2. A "full" type: new records are saved when the user buys something and provides all their billing/shipping details, etc. Model: -
2007 Aug 08
5
and_yield + instance_eval(&block)
I have the following code, which yields instance eval''s the block given: class Foo def bar(&blk) instance_eval &blk end def baz yield end end The effect of this is that self is reassigned: Foo.new.bar do # here, self is the instance of Foo # created by new end But normally self is the object in which Foo.new.bar {...} occurs. Foo.new.baz do
2005 Nov 07
5
Switchtower deployment
Hi, Has anyone experiences using SwitchTower (Windows) in a shared hosting environment (Textdrive)? I already patched the SwitchTower rake tasks (I don''t know if someone is interested on it), but i still experience some problems (not in the sudoers list, ...). Thank you for answer (and thank you to the textdrive guys, i never had a such fast support!) -- Jean-Etienne Durand
2007 Sep 27
10
Adding more sugar to wxSugar
Hi all, New wxRuby event handling offers the choice between using blocks or methods seamlessly and easily. This is great respectively for simple app and more complex app. Nevertheless, currently the creation of an application, a frame, or a dialog is very tedious for simple app : - you need to create a subclass of Wx::App, Wx::Frame ... - you need to put the initialization code in the initialize
2006 Feb 10
1
instance_eval and Proc objects
Hi All, Got a bit of a Ruby question for you. If I have a function that makes a proc object like this: def select(selector, &proc) el = Element.new el.instance_eval proc end select("#thing") do hide end Wat I want to do is evaluate the Proc in the context of el but this doesn''t work because instance_eval accepts a string or a block and not a Proc object. I sense
2006 Jun 27
3
Weird ActiveRecord Foreign Key Problem
Hello to all, I ran into a weird problem with an ActivRecord. I have a table named "build_order" with a column named "type" that is a foreign key to a table called "building_type". In a controller I try to read all the build_orders with "BuildOrder.find :all" and get the following error and stack trace: (eval):1:in `instance_eval'': compile
2006 Jun 26
1
ActiveRecord, instance_eval, and PStore
I''m trying to add some per-object behaviors to objects descended from ActiveRecord, by using after_initialize() and instance_eval(), like this: def after_initialize self.instance_eval(File.read(''customers/default.rb'')) end (Ultimately the file path will be dynamic, this is just proof of concept.) default.rb just contains a few method definitions like this one: def
2006 Dec 14
8
ActiveRecord outside of rails
I have a few questions regarding using activerecord outside of rails. Usage is with legacy databases, which gives rise to some of the problems. Probably the first, and most simple question though, is how to capture the SQL log, with which I can hopefully figure the other stuff out. I''m currently trying ActiveRecord::Base.logger = Logger.new STDOUT Based on random googles, but it
2006 Dec 21
1
need some guidance with a test
This is part of a rails project. The following method is part of the Ams class (a rails model). I''m a bit unsure of the rspec/bdd way of testing this method. def persist_as_domains @current_domains.each do |d| dom = Domain.new dom.domain = d dom.source_id = 1 dom.at = Time.now dom.save end end The following is what came out when I tried to write my test. Notice
2007 Jan 24
3
Another ''found a bug'' problem - This time with user purging.
Ok, given the statement on the web page about unlesssystemuser under Resources ( http://reductivelabs.com/projects/puppet/documentation/typedocs.html#resources), I assume that users can be purged. However, when I attempt to do this with resources { user: purge => true, noop => true } and what I get is: err: Found a bug: private method ''split'' called for nil:NilClass.
2011 Jun 02
10
Application Error!!!!!!!!!!!!!!!!!!!!!!!
Hi everybody, Please any one help me, Previous two day''s I am googling, Still not find solution. this really frustrating. I had deploy my app on heroku http://radiationn.heroku.com/. it is working fine on localhost but i got APPLICATION ERROR. IN log wht i find that in photo.rb model not able to find "has_attached_file", I am not able to shout out this proble. It working
2009 Sep 10
2
passenger with ruby enterprise edition
Hi I am failing to start apache2 with ruby enterprise edition and passenger 2.2.5 [Wed Sep 09 17:38:20 2009] [notice] Apache/2.2.11 (Ubuntu) mod_ssl/2.2.11 OpenSSL/0.9.8g Phusion_Passenger/2.2.5 configured -- resuming normal operations *** Exception LoadError in PhusionPassenger::Rack::ApplicationSpawner (no such file to load -- puppet) (process 16544): from
2007 Aug 07
2
stubs which yield and return
Is there any reason why a stub couldn''t both yield and return? I''m looking for a way to mock out a class I''ve made named "AnonymousClass": class AnonymousClass def initialize(&blk) @klass = Class.new @klass.instance_eval(&blk) if block_given? end def new @klass.new end def evaluate(&blk)