Displaying 5 results from an estimated 5 matches for "examplecontrol".
2006 Apr 14
2
Puzzled with filters
...all
controllers. I put it in application controller (application.rb).
class ApplicationController < ActionController::Base
after_filter :tidyit
def tidyit
xxxx # syntax error - intentionally
end
end
I have a Example (example_controller.rb) controller with index action.
class ExampleController < ActionController::Base
def index
@result = "Hello, world!"
end
end
When I try to access server:3000/example/index I see my hello world
string. But it should be compile error (see "xxxx" in filter code). No
matter what I do inside the filter, this filter is not a...
2007 Jul 14
2
Using Helpers inside a Controller
I want to use helpers inside a controller method for an AJAX
application. After the page is loaded and displayed, there will be an
asynchronous javascript request to load additional resources such as
html forms and other data.
The controller which handles the request will collect the resources and
send them back in json format.
def get_resources
data=Hash.new
data[:form1]=form_helper1()
2007 May 23
8
Rails Rendering diagnostics.rhtml in Controller Spec
Forgive me if this isn''t the proper list. It''s specific to the rSpec
Rails plugin.
The problem is, some controller actions are rendering the
"diagnostics.rhtml" template when I''m expecting it to render something
else in a controller spec. I''m assuming this is the template that
displays the error message and a stack trace when an error is raised
in the
2007 Oct 04
5
Specs and Libs
How would I go about writing specs for a lib, particularly one with
all protected and private methods. I''m trying to spec the
AuthenticatedSystem library from the rails restful_authentication
plugin:
http://pastie.caboo.se/103625
Also, when you''re mocking objects, a side-effect is helping you
define the api of the object. Is there a way to get all the
behaviors that
2006 Mar 23
3
How to redisplay submitted data on validation error?
Hi!
If i have an object it''s easy.
But i''m making a simple contact form and i check if email address is
correct. If it''s not i redisplay the form with the info that there was
an error (should i use redirect_to or render :action? what''s the
difference?), but all previously submitted data is lost.
I tried creating variables using names of the form fields, but