Displaying 20 results from an estimated 10000 matches similar to: "I'd like to turn off logging for a particular controller"
2006 May 11
1
skipping filters
I have a simple login scheme in application.rb. Something like
:requires_login is called in any controller as a before_filter. All is
good, except I''m having trouble figuring out how to make the public
login actions skip this before filter. Here''s what I have:
application.rb
skip_before_filter :requires_login, :only => [:login, :logout,
:confirm_valid_login]
2013 Feb 28
1
how to use before_filter to decrypt post data
hello, everybody.
in ror, we can add a after_filter to a controller.
def aes_encrypt
response.body = AesHelper.aes_encrypt(response.body)
end
after_filter :aes_encrypt
and all action''s repsonse int the controller can be encrypt.
and my question is , how to decrypt data use before_filter, or anything
else.
ex: i want to post json data to /usr/register, the json data is
2006 Nov 21
2
before_filter in actionwebservice controller using direct dispatching
The docs say that for direct dispatching mode to use controller
filters, but when the controller is run I get the following error.
The authorize method is in application.rb. Works fine when it''s not a
web service api. Should I be using before_invocation instead even
with direct dispatching mode? Or can I not have the authorize method
in application.rb?
undefined method
2008 Sep 13
2
<meta http-equiv="refresh" content="5"/>
Do you know of any way for me to stick a meta tag in using a
before_filter or after_filter or around_filter?
<meta http-equiv="refresh" content="5"/>
I have been trying to figure out out and just cannot make sense of it.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2006 Jan 16
3
routing to controller inside module
Hey,
am i to stupid to find the information about how to route to a
controller in a module? Maybe module support has gone!
The controller is under:
app/controllers/admin/my_controller.rb
The my_controller.rb file looks like this:
module Admin
class MyController
def index
render :text => ''Hello!''
end
end
end
How does a route to all controllers under module
2010 Jan 31
3
Append/Prepend to a template from controller method
I want a method in app/controllers/application.rb that can
prepend/append text to whatever template gets rendered. Of course I
can''t call render twice w/o getting a double render error, so is this
possible?
I want to redirect after a delay using a meta refresh. Here''s what I''ve
got:
app/controllers/application_controller.rb:
def redirect_after_delay (url, delay)
2006 May 25
0
Double Render Error...
I''ve been fighting with a Double Render Error.
I have some sidebar partials that I render to strings in my
application controller''s before_filter:
@left_sidebar_for_layout = render_to_string(:partial => ''shared/left_sidebar'')
Then in my application layout, I simply add them as a string, like I
would @content_for_layout
This normally works fine.
However,
2007 Dec 23
5
prepend_view_path not working
Now that controllers can have multiple view paths I''ve been playing with
themes over the weekend. Running into a view issues. I have a
before_filter in the ApplicationController that calls prepend_view_path
to add the path of my theme. I even log the view_paths in an
after_filter to make sure it made it all the way through. The output
looks something like:
2006 Jan 05
1
unicode hacks - fixes for webrick and Safari
Hello!
First, thank you Julian for the useful plugin ''unicode_hacks'' <
http://julik.textdriven.com/svn/tools/rails_plugins/unicode_hacks/>.
I have found some problems running my app in development on Webrick
and looking at it with Safari (MacOS X 10.4.3, Safari 2.0.2). Some
files are sent with different sizes (e.g. default css example, or
controls.js ), and it
2005 Dec 09
1
utf-8 BIG problems
hey,
------------------
i have change my db to utf8-general-ci, now all the characters are correct in
the database, i need this for exporting to pdf en excel. now i can also import
from csv, characters like éàï....
But the display is then fucked up. i get wierd symbols
-------------------
Another situation:
I have seen a post here to add to environment.rb:
$KCODE = ''UTF8''
2006 Aug 06
0
Can I strip a file suffix off a URL with routing?
I would like a route that strips of the suffix of a url before
determining the action. Eg:
http://mydomain.com/my_controller/my_action.pdf
Would map to: { :controller => ''my_controller'', :action => ''my_action'' }
Is this possible?
Thanks,
-Jonathan.
2007 Nov 16
3
Route Information
Is there a method to return a hash of the route configuration based on
a path?
For example:
magic_method(''/my_controller/my_action/my_id'')
=>
{:controller => ''my_controller'', :action => ''my_action'', :id =>
''my_id''}
Thanks!
Tom
--~--~---------~--~----~------------~-------~--~----~
You received this message
2006 Feb 05
2
working with rails and unicode
I''m trying to get basic unicode support working using the "Iteration
A1" sample application from the "Agile Web Development With Rails"
book.
Following the "HowToUseUnicodeStrings" wiki document, I have made the
following changes:
config/environment.rb:
# Include your application configuration below
$KCODE = ''u''
require
2006 May 09
1
Reusing a model to form and link_to.
Hy guys,
Inside my app I have a form which contains user information.
Sometimes a have a form with a text_field as above:
<%= form_remote_tag(:html => { :action => url_for(:controller =>
"my_controller", :action => "my_action") }) %>
<%= text_field(''my_object'', ''my_parameter'', :maxlength =>
2006 Aug 10
1
Web service SOAP URLs started failing with 1.1.4 or using 1.1.2 security patch
Railers,
I''m trying to figure out why invocations to my Web service URLs work
with Rails 1.1.2 but fail both with Rails 1.1.4 (and 1.1.5) and when I
apply the new 1.1.2 security patch to Rails 1.1.2.
It looks like they are failing with SOAP clients but succeeding with
XML-RPC clients.
The URL that used to work is of the form
http://localhost:3000/my_controller/ServiceName/api. 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
2006 Sep 22
6
Using after_filter to control rendering on actions
I have a common failure page that I may need to render to upon failing
some test that occurs in an after_filter method.
I''d like to use the after_filter to take over the control of the
rendering, like so:
def test_for_validity
some_boolean = my_test
return render(:action => ''disqualified'') unless some_boolean
@success_controller ||= controller_name
2008 Sep 24
3
caches_page :if not executing (but caches_action :if) does
Hi folks -
Seeing a weird problem and would love some help. It''s documented in
http://pastie.org/278310 to be more readable.
In short, I have a
caches_page "action", :if => {stuff}
but the :if is never being called - the action is just caching every
time. (If I put a debugger call in the :if block, it never stops.)
If I replace caches_page with caches_action, the if
2006 Jul 10
2
Mongrel caching
I am using mongrel to serve static as well as dynamic pages.
The static page''s controller contains the following line of code:
after_filter {|c| c.cache_page}
This code caches that page as a static html page that does not have to be
rendered form multiple files (the view and layout). I got the idea to do
this form the rails recipes book. It definitely cached the pages. Wen I
make
2007 Nov 30
5
render_to_string in an after filter
I''m using render_to_string in an after_filter, which renders a partial
that is sent to a web service. Here''s the code:
class MyController < ApplicationController
after_filter :post_to_webservice
def show
# show logic
end
def post_to_webservice
stuff = render_to_string :partial => ''stuff''
webservice_post(stuff)
end
I get a DoubleRenderError in the