Displaying 20 results from an estimated 168 matches for "controller_name".
2005 Dec 15
6
Navigation menu
I have a navigation menu that contains a link per controller in my
application.
This menu is the same for all controllers, but I want this behaviour:
<a>Users</a>
<span>Statistics</span>
and
<span>Users</span>
<a>Statistics</a>
depending on the page you''re currently on.
I''ve put a <render :partial =>
2007 Mar 19
3
controller_name with dynamic controllers
...er which inherits
from the generic CRUDController, without actually creating the
controller. This controller is *only* for testing.
How can I do this? I can''t do something like this:
Object.const_set("MyCrudController", Class.new(CRUDController))
because the method "controller_name" will complain of setting the
constant twice.
Any ideas?
Best,
Scott Taylor
2006 Jul 22
4
Accessing the controller name in your views?
...currently in
to do various things in my layouts/application.rhtml file. Isn''t
there is a better way than:
<% if params[:controller] == "whatever" && params[:action] ==
"whatever" %>some html<% end %>
I know in the controllers you can just use controller_name, but that
is not provided in the views.
Thanks for your help.
Thank You,
Ben Johnson
E: bjohnson@contuitive.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060722/00d23b12/attachment.html
2007 Jan 29
2
Cryptic error message when no controller_name
...y2/vendor/plugins/rspec_on_rails/lib/spec/rails/context/controller.rb:151:in
`setup''
Line 134 of controller.rb is:
@controller.session = session
We are probably only missing a check to ensure that @controller is
somehow defined. Failing that should simply say "You forgot to define
controller_name in your controller spec".
This is on 0.7.5.1.
Thanks !
--
Fran?ois Beausoleil
http://blog.teksol.info/
http://piston.rubyforge.org/
2007 Oct 23
9
Running rails specs outside of the normal project tree
I want to create a spec/regressions directory with various
regressions (for my rails project). I tried the following:
describe LoginController, "regression for user creation when
steves_sister does not exist", :behavior_type => :controller do
controller_name :login
before :each do
@params = {
"commit"=>"Create Account",
"account"=> {
[snip]
end
But I got this error:
1)
NoMethodError in ''LoginController regression for user creation when
steves_sister does not exist should not ra...
2006 Jul 21
0
Getting controller_name from inside an Observer
Hi,
Anyone knows if there is any way to get the controller_name from an external
Observer class?.
Thanks.
2007 Dec 12
3
undefined method: controller_name
...e.dirname(__FILE__) + ''/../../spec_helper''
class DummyController < ApplicationController
def index
raise "Prevent index from rendering"
end
end
describe ApplicationController, "Handling errors in production",
:behaviour_type => :controller do
controller_name :dummy
before(:each) do
# set up request and response
lambda { get :index }.should raise_error
end
it "should display ''file not found'' when a routing error occurs" do
controller.rescue_action_in_public(ActionController::RoutingError.new("this...
2007 Apr 12
1
rspec on rails: undefined method ''controller_name''
...mail/rspec-devel/2007-March/002147.html
), but I get the error no matter how I run the spec
( whether I use rake or not)
Any ideas?
I am using 0.8.2
The Error:
C:/rails/InstantRails/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib/spec/expectati
ons/sugar.rb:14:in `call'': undefined method `controller_name'' for
#<Spec::Runner
::ContextEvalModule:0x35e6a98> (NoMethodError)
from C:/rails/InstantRails/ruby/lib/ruby/gems/1.8/gems/rspec- 0.8.2
/lib/s
pec/expectations/sugar.rb:14:in `_method_missing''
from C:/rails/InstantRails/ruby/lib/ruby/gems/1.8/gems/rspec-0.8.2...
2006 Apr 27
3
Routing problem
Hi,
I am having a routing problem and can''t figure out why its happing. I
have added the following line in my routing.rb file.
map.connect ''name/:id'', :controller => ''controller_name'', :action =>
''action_name''
When I use http://domain.com/controller_name/action_name/id then it
works fine on the local machine using webrick as well as on a live site
using apache. But when I use http://domain.com/name/id then it crashes
the webrick on local machi...
2007 Jul 24
4
spec''ing helpers that use controller
Hi all,
I''m in the process of creating rspecs for my helpers. One of the
helpers in app/helpers/application_helper.rb looks like this:
def page_name
@page_name || "Define @page_name in
#{controller.controller_name}::#{controller.action_name}"
end
The rspec is simply:
it "should something" do
page_name
end
Running ./script/spec spec/helpers/application_helper_spec.rb produces:
F
1)
NameError in ''Application...
2006 Jan 23
5
Variable Scoping Problem
I am having some problems with variable scoping.
I need to be able to set a variable that is accessable by other methods
within the class (or instance) (i.e not global).
An example is 2 pages that change a class variable:
class AjtestController < ApplicationController
def initialize
@@variable = "init"
end
def show
@display = @@variable
@@variable = "change 1"
2006 Jun 01
9
access model from controller
Hello,
Rather new to RoR, so I''m not sure about the terminology and such :-/ .
My question is: how could I know the model which is associated to a
controller?
For example:
- controller class is TestController, which is a subclass of
ApplicationController
- associated model class is Test
How could I write some code in a method of ApplicationController to
dermine the current
2006 Feb 02
2
multiple ''render :partial'' in a helper ??
Hi all,
I''d like to move some view code to a helper but it doesn''t work because
I need to render two partials each time.
Q: Is it possible to do this with a helper?
Example:
-----------------
Before: In the view:
...
<% case controller.controller_name
when ''member'' %>
<%= render :partial => ''shared/member_menu'' %>
<%= render :partial => ''shared/member_submenu'' %>
..
<% end %>
...
After: In the view:
<%= generate_menu %>...
2007 Mar 24
1
RSpec and namespaced controllers
...r.rb (inside /admin) fails when I run the tests from rake.
I think there''s a collision between the two controller name, or else
RSpec/Rails isn''t parsing the second controller''s name correctly.
For reference, in /admin/tenants_controller_spec.rb, I''m setting the
controller_name as:
controller_name ''admin/tenants''
Any thoughts on what might be going wrong?
Thanks,
Bruno Bornsztein
www.missingmethod.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070324/e31bb651/...
2007 May 08
4
help with rspec''ing controller
...ck ''remedy'' expected :save! with (any args) once, but received it 0
times
-or-
Mock ''Remedy'' received unexpected message :save with (no args).
Here are my two sample approaches:
describe "Create with a valid product and authenticated user" do
controller_name :products
before(:each) do
@product= mock(Product)
Product.stub!(:new).and_return(@product)
end
it "should tell the Product model to create a new product" do
#mock_user_authentication(true)
Product.should_receive(:new).with(:params).and_ret...
2007 Jun 27
2
Controller specs not shareable?
Hi
I just wondered if there was a reason why Rails controller specs are
not shareable? eg
describe "All XHR POSTs to /gap/calculate_quote", :shared => true do
controller_name :gap
# ...
end
describe "XHR POST /gap/calculate_quote with valid details" do
it_should_behave_like "All XHR POSTs to /gap/calculate_quote"
# ...
end
blows up with the following error:
##########
/Users/ashleymoran/Documents/Development/YourMoney/trunk/src/vendor...
2011 Feb 21
2
self.prepend_view_path - am I missing something
...c.
Rails 2.3.10 and looking at the documentation at
http://rubydoc.info/docs/rails/2.3.8/ActionController/Base#prepend_view_path-instance_method
application_controller.rb
before_filter :domain_lookup, :set_view_paths
protected
def set_view_paths
self.prepend_view_path "app/views/#{controller_name}/
#{@domain.policy.policy_type}"
end
according to the documentation this should add this path to the front
of the search order for this request only (as opposed to the similar
class method which prepends for all future requests)
I would expect the template to be rendered for the controller...
2010 Sep 06
5
how to call rails method from javascript method.
hi
I wanna call rails method from the javascript method.
It should be ajax call for rails method.
please help me.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe
2006 Nov 28
8
view specs with partials
When I first learned about the View specs I was very excited. I
still am. However, I haven''t found them useful yet for one reason.
They throw the following exception when ever a view renders another
view, which is very common.
ActionView::TemplateError in ''Event View message''
No rhtml, rxml, rjs or delegate template found for spec/rails/
view_spec/_info
2006 Apr 11
4
wrong number of arguments (2 for 1)
Hi,
Im having trouble figuring out how to query my database in ruby and
i''m hoping someone can help me out.
I''d like to find all my departments that match a permalink passed from
the url. The department must also match a particular category, also
passed through the url.
I have written the following code. But unfortunatley I get an error
"wrong number of arguments (2 for