Displaying 20 results from an estimated 1500 matches similar to: "subclasses with inherited_resources?"
2008 Feb 02
0
Adding methods to Object in Rails -- WARNING
I wanted to do:
foo.wrap
and wrap would go to a specialized wrap for some types of foo and a
general Object#wrap for all the others.
So I added wrap to Object
class Object
def wrap
self
end
end
This worked except for objects which are actually AssociationProxy
objects pretending to be some other object. The reason is that
AssociationProxy removes all but a few methods from itself.
2012 Mar 07
0
LoadError: Expected X to define on gem upgrade
I''m upgrading to the latest version of ActiveAdmin and am running into the
following when trying to start the app:
Expected ../app/model/store/base.rb to define Base
base.rb defines base like:
module MyApp
class Store::Base
end
end
I''ve done some digging and found that ActiveAdmin did some refactoring to derive everything from a BaseController. It also depends on
2011 May 28
0
class_inheritable_accessor => class_attribute
I had code
class_inheritable_accessor :attrs, :instance_reader =>
false, :instance_writer => false
self.attrs = {}
now i want to get rid of class_inheritable_accessor, but
class_attribute only supports instance_writer, not instance_reader
options and i really don''t want instance reader. Is there any way to
do it?
--
You received this message because you are subscribed to the
2012 Sep 28
0
Overriding class_attribute writers and order of super/extend C.M./included block eval in ActiveSupport::Concern
I have:
module MySpike
extend ActiveSupport::Concern
included do
class_attribute :foobar, instance_writer: true
end
end
But, I want to be able to override the class attribute writer and/or
instance writer method to do something when the attribute is set via
self.foobar = true before or after calling super to set the attribute.
Unfortunately, I can''t find a clean way
2007 Sep 18
2
rSpec / Nested Routes / Mocks
I''m having a terrible time trying to test a nested route with rSpec.
I can''t seem to tell rSpec to expect the call @item.user. The
following error message plagues me not matter how I try to fuss with
the mock:
Spec::Mocks::MockExpectationError in ''ItemsController handling POST /
items should redirect to the new course on successful save''
Mock
2010 Nov 30
2
Did I miss a meeting?!
I''ve just stumbled (literally, while I was trying to fix a glitch I
was having after upgrading Aegis...) on the Inherited Resources gem...
why did no-one tell me?! ;-)
Is everyone else using some form of controller base-class? Am I the
last on this bus!
https://github.com/josevalim/inherited_resources
--
You received this message because you are subscribed to the Google Groups
2006 Aug 24
2
Design questions on creating digg.com-like URLs (are they considered RESTful?)
Hi everyone, I''m working on creating a site that functions similar to
digg.com (please no "no more digg clones" remarks please! :) ). One
thing I really like about digg is there URLs are very nice to read and I
would like to emulate that without having a lot of actions spread out
all over my application.
So in my app I have three main resources:
Users, Tags, and Items
2009 May 03
0
HTTP Auth 401 Even on Valid Login
I can''t understand why authenticate_or_request_with_http_basic keeps
failing even though I am entering the correct info.
If I try to access /admin/items/new, I enter the correct info but I
keep getting prompted.
The strange part is that when I cancel out, I get "HTTP Basic: Acce".
Here''s the controllers:
class Admin::BaseController < ApplicationController
2007 Mar 21
0
Getting the module name with ObjectSpace...
Hey :)
I''m trying to create a method for making a sitemap dynamically. It
works great for flat sites where you simply have your controllers in
the app/controllers directory. In this case, I can extract the
controller names like,
@controllers
ObjectSpace.subclasses_of(ActionController::Base).each do |obj|
@controllers["#{obj.controller_name}"] = obj
end
However,
2009 Apr 19
1
Cucmber: Mysql::Error: query: not connected: ROLLBACK
Hi,
I ran in trouble with unexpected rollbacks using cucumber 0.3.0.
My feature-file looks like
Scenario: Create Valid Item
Given I start
and the step is
Given /^I start$/ do
get "/items"
end
In my log/test.log I get
SQL (0.2ms) SET NAMES ''utf8''
SQL (0.2ms) SET SQL_AUTO_IS_NULL=0
SQL (0.1ms) BEGIN
Processing ItemsController#index
2006 Nov 22
2
.class call to the mock object (or any existing methods)
Hi
I run into problem trying to set expectations for the mockobject.class
method, I had to undefine a method before I could set some expectation. Is
there any better way of doing it?
object = mock()
....
klass = class <<object; self; end
klass.send(:undef_method, "class") # I had to do this because Mocha
utilizes "method_missing(symbol, *arguments, &block) "
2007 Oct 26
3
Specing with Subdomains as Account Keys
How do you go about implementing and rspecing subdomains as account
keys? I''m sure that this must be an issues for others as well.
So I have an app using subdomains as account keys. The Application
Controller sets up @current_company in a before filter. Everything is
done within the context of the @current_company.
After reading about Demeter''s Revenge
2012 Feb 16
1
How to disable instrumentation in rails 3?
There is a bug in jruby that causes thread locks around things like
accesses to class attributes created with class_attribute. The
notifications system is affected by this, and it''s blowing up our app.
We need to disable all instrumentation and notifications for the time
being. Anyone know how to do that cleanly?
CHris
--
You received this message because you are subscribed to the
2007 Jan 02
4
allow stubbing of previously defined methods such as "id"
On my current project I needed to create a stub that responded
correctly to the id message. Here''s the change I put into my copy of
head.
Index: lib/mocha/mock_methods.rb
===================================================================
--- lib/mocha/mock_methods.rb (revision 1114)
+++ lib/mocha/mock_methods.rb (working copy)
@@ -68,6 +68,7 @@
method_names =
2008 Oct 03
1
fragment caching with search box
I''m trying to setup some fragment caching which works fine for the index
but i''m not sure how to ignore the caching if they are searching the
index results.
my code in short:
ItemsController
def index
@items = Item.search(params[:search], params[:min_rank],
params[:max_rank], params[:classification_id], ...)
end
index.html.erb
<% cache (''items'',
2006 Mar 10
0
WEBrick crashing
ruby 1.8.2 (2004-12-25) [i386-mswin32]
latest version of edge rails - patched to make the server work with
win32 (http://dev.rubyonrails.org/ticket/4139)
On some pages WEBrick is crashing with the following:
d:/programming/ruby/lib/ruby/1.8/profiler.rb:27: You have a nil object
when you
didn''t expect it! (NoMethodError)
You might have expected an instance of Array.
The error occured
2012 Oct 03
1
Is there planned support for permitting params one at a time vs. all at once in strong_parameters/Rails 4?
Was going to have a variety of request params sent in and use a
class_attribute that would define types of request parameters that are
allowed. strong_parameters wouldn''t be too much trouble in such a case if
it would allow me to manually permit some attributes (dynamically
determined) in the controller but allow strong_parameters to enforce
security of others.
Is this something
2006 Apr 05
1
select in *.rhtml
I''m trying to get a select box of categories to appear in my items views
after I created everything using generate scaffold, but I can''t get the
categories to appear in my forms.
class ItemsController < ApplicationController
def new
@item = Item.new
@category = Category.find_all
end
...
class Item < ActiveRecord::Base
belongs_to :category
end
class
2008 May 08
0
Controller/action not working in url
Hey guys,
i am facing some problems in calling an action. see details:
in sale_items controller, i have a function
def saleedit
--code--
render ( :action => ''saleedit'')
end
and i have a file in view/sale_items/saleedit.html.erb.
okay. now i have one more view view/sale_items/new.html.erb. in this
file i have a form like this:
<% form_tag url_for(:action =>
2007 Mar 04
4
Rails functional testing and Mocha
I''ve always wanted to be able to do stuff like this in my functional
tests
c = customers(:customer_1)
c.expects(:great_customer_service)
post :service_customer, :id => c.id
This of course fails because inside the rails action a different
instance of customer is used. Some of the time setting your
expectation/stubbing on Customer.any_instance works, but it''s not