Displaying 2 results from an estimated 2 matches for "example_controller".
2006 Apr 14
2
Puzzled with filters
...39;m trying to create an after filter for all my actions in 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...
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()