similar to: reloading include-modules inside controller not working

Displaying 20 results from an estimated 1100 matches similar to: "reloading include-modules inside controller not working"

2006 Jun 13
7
ActiveRecord attribute= overload
I want to overload the = operator for one of the attributes in a model to run a filter on the input. However I can''t do this: def attribute=(data) self.attribute = filter(data) end because that creates an infinite recursive loop. How do I get around this? -- Posted via http://www.ruby-forum.com/.
2006 Mar 21
4
Determining Browser?
Is there a way I can read the user agent or something similar to determine whether the person is using IE, Mozilla/Netscape, Opera, Safari, etc? I want to dynamically output the CSS to the browser, but I''d like to change certain things (in this case the widths of some divs since IE adds borders and padding size to the total size of a div unlike firefox). Thanks, - Brent
2007 Sep 27
1
rspec_on_rails: controller method not getting called
In my rspec_on_rails controlle rspec, I have this: require File.dirname(__FILE__) + ''/../spec_helper'' describe FooController, "with a foo" do it "should be false" do get ''index'' assigns[:foo].should be_false end end In my controller I have this: class FooController < ApplicationController def index @foo = FALSE end
2007 Aug 04
5
reusable specs - almost there
I have a lot of controllers with virtually identical functionality for most actions. I''ve been using shared behaviours to DRY things up a bit, but I still have to create separate behaviours for each context before I can use the shared behaviours what I have now is a generic file which contains all the behaviours and examples common to all the controllers, and that file gets loaded from
2006 Apr 20
7
AJAX/RJS Updating of Table Rows
I''m trying to update a table row (i.e. replace a <tr></tr>) using AJAX/RJS but of course this cannot be done in IE (works fine in Firefox). I have googled but have not found any solutions, only a lot of discussion. Does anyone have a solution to this problem? Cheers, Nicholas
2006 Feb 03
4
(BUG in svn/trunk?) - superclass mismatch for any subclass of ApplicationController
I track svn/trunk of Rails using svn:externals Some change to Rails committed in the last 1-2 days broke my subclass of ApplicationController The example, below, works with Rails 1.0, but in today''s svn, it dies with the following error: "superclass mismatch for class FooController" class ApplicationController < ActionController::Base end class FooController <
2005 Dec 15
5
initialize called more than once?
Hi, In my test case below, it seems that ''initialize'' is called everytime ''hello'' is called. Is this by design, a bug, or my pilot error? class FooController < ApplicationController def initialize print "\n initialize \n" end def hello print "\n hello \n" end end I
2006 Mar 09
4
Stop users accessing methods.
Hello all. Is there a way to stop users from being able to access a controllers methods without affecting the ability of other controllers to use them? i.e FooController def secret #Stuff end end BarController def index redirect_to :controller => ''foo'', action => ''secret'', :id => ''007'' end end But directly
2008 Apr 29
1
Spec''ing controller macros
Hi, (This is my first post after months of appreciative lurking...) I''m trying to spec the following conditional controller macro: class ApplicationController < ActionController::Base # turn off session management for robots session :off, :if => lambda {|req| req.user_agent =~ /(Google|Slurp)/i } # ... end My current attempt seems to be quite unsuccessful: 1) when I
2006 May 11
1
rendering in after_filter
Hi! Is it possible to render the action within the after_filter method, or is the rendering performed before? I have something like this: class FooController after_filter :send def a @content=... end def b @content=.. end protected def send send_data(@content,...) end end However, when calling the action a or b, the @content doesn''t get sent, but instead
2005 Dec 20
2
printing/logging during tests
Hi all, I''m trying to output some info to see what''s happening in a controller during functional tests. Problem: ''print'' only works in the test code, but not in the production code that''s being called by the tests. Example: In FooControllerTest: def test_list print "1: starting" <<----- WORKS FINE get
2005 Feb 15
1
Modules Beta Comments
I''m not sure but I think this is due to the ''modules'' support in the latest beta gems. In some controllers I include small utility classes that only make sense for that controller. Something like this: class SantasLittleHelper < Foo end class FooController < ApplicationController end Where Foo is defined in RAILS_ROOT/lib/foo.rb What I am seeing now
2007 Nov 23
12
namespaced controllers
Out of curiosity, I''ve seen the following fail: module Admin describe MyController ... end end But this works fine: describe Admin::MyController .. end Why? Scott
2006 Mar 27
1
polymorphism + inheritance
Hi, currently I do some work with polymorphic associations in egde rails class Order < ActiveRecord::Base belongs_to :payment, :polymorphic => true end class CreditCardPayment < Payment end class PayPalPayment < Payment end class Payment < ActiveRecord::Base has_one :order, :as => :payment # common stuff in here end I want to use [Payment] for common functionality
2006 Mar 22
5
foreach item in column
Hi there, I have a database with phonenumbers, and I want to make a function that runs a command for each of these numbers, with the number as an argument Something like this in Perl: system("/bin/command $number"); mysql> select * from numbers where list = "one" +----+----------+----------+---------------------+-----------+ | id | number | name | email
2006 Apr 05
7
select_tag - populating options
Hello, I want to a select tag, where you can choose a number between 1 and 100. My inital code is based on the examples from Agile Web Development with Rails, and looks like this: view: <%= options = [["Select number of lines", ""]] + RfqLines::LINE_QTY select("rfq_line", "line_qty", options) %> model: LINE_QTY = select_fill def
2006 Jun 22
12
invalidating a session on multiple login
How do I do the following: if a user is logged in, then opens another browser tab and logs in again (either as himself or as someone else), I want to invalidate the session in the first tab and throw up a "logged in from another browser window" screen. RIght now, user1''s session silently becomes a duplicate user2 session instead (from what I understand, sessions are bound to
2007 Jan 10
1
Solution for undefined method `use_transactional_fixtures=' ... problem
If you see this error message: undefined method `use_transactional_fixtures='' for Test::Unit::TestCase:Class (NoMethodError) You should check all your dependencies, all the lines containing require and especially require_dependency. You have probably done a refactoring "Rename" a class and forgot to propagate the change everywhere! More details on
2006 Mar 02
3
How to identify the browser?
I need to generate some browser-specific code; can I identify which browser is being used from within my RoR code? -- Posted via http://www.ruby-forum.com/.
2007 Aug 31
2
Can module spec "behave like" controller spec?
Hello everyone: Right now I am writing spec on modules, which are provided by my colleagues. Some of the modules actually contain action methods. I tried very hard to spec those action methods in modules. But it seems that the rspec does not allow module spec to ''get'' action like controller does. After I saw the documentation, I then used :behaviour_type=>:controller.