Displaying 20 results from an estimated 3000 matches similar to: "skipping filters"
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)
2008 May 06
12
Why before_filter is not working?
I have been scratching my head on this one for most of the day.
Hopefully someone can help explain why before_filter isn''t working for
my codes.
In my Application controller, I have this:
before_filter :login_required, :except =>
[:newacct, :create_newacct, :passwd_reset ]
def login_required
unless session[:user_id]
flash[:notice] = "Please log in"
2008 Jan 11
0
trouble skipping before filter in controller
Hello,
In my application I want several before filters to apply to every
request except for login and authenticate. So in my application
controller I have
before_filter :setup_user, :check_for_duplicate_user, :update_timestamp, :kick_if_inactive
then in my user controller which contains the login and authenticate
actions i have
skip_before_filter :setup_user, :only => [:login,
2007 Dec 03
2
before_filter application => exclude some other controllers
Hello again,
It''s possible to use before_filter in the application_controller, and
exclude for some methods from other controllers ?
i have a before_filter in application_controller that checks if the user
is logged, if the time hasn''t expired, ... and I want to exclude some
methods of this check, like the login. This ''login'' belongs to other
controller.
I
2006 May 25
5
Setting a global before_filter action in application.rb
Can you set a global before_filter action in application.rb?
So, for example, you could control authentication for all of the
controllers in an app.?
Obviously, you would need a way to reference actions by controller
within this "global before-filter".
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
2008 Jan 30
2
Where can I get "authenticate_with_http_basic"?
Hi,
I just installed Rails 2.0.2
[root@mymachine easyx]# ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]
[root@mymachine easyrx]# gem install rails --include-dependencies
Need to update 16 gems from http://gems.rubyforge.org
................
complete
Successfully installed rails-2.0.2
[root@remandev easyrx]#
But I''m getting this error in my restful_authentication
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
2006 Apr 23
2
Check if current route == some route
I have a before_filter in ApplicationController in which I want to check
if the current location is the same as a certain route, so that I only
redirect non-logged in visitors to the "join" page if they''re not on
that page already.
The code I came up with is a bit ugly:
redirect_to join_url unless (@logged_in or action_name == "join")
I''m pretty sure
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
2007 Mar 20
1
Passing Arguments to before_filter
I want to put a before_filter in application.rb, as follows:
before_filter :do_something, :except_controller => [:admin]
def do_something(options)
options.stringify_keys!
unless options[:except_controller].include?(controller_name)
# do something useful
end
end
Where I''m blocking is on how to get the ''options'' data in the do_something
method. I think I
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
2008 Dec 19
2
before_filter for a specific controller/action
I''m learning about before_filter, implementing a simple "you must be
logged on" thing.
It works great, but I need to allow people to create a player as well.
By writing the except as attached, that works, but then everyone has
access to all "new" methods, which I don''t really want.
Can someone help me with how to properly construct this to limit
non-logged
2009 May 05
3
Unable to deactivate forgery protection
Hi,
I just created a new Rails app that will be receiving some POSTed data
from the outside so it must skip the verify_authenticity_token for some
create actions. Although I have added:
skip_before_filter :verifiy_authenticity_token
I still get InvalidAuthenticityToken. In one of my other Rails app
(created back in Rails 1.2.6 and updated to 2.3.2 over time) this
skipping works perfectly though,
2006 Nov 04
3
role based authorization question
I am using the the authorization recipe outlined in Rails Recipes.Is it
possible for one role, say ''admin'', to have access to every action on every
controller without explicitly having to create a Right for each?
I know this will not work as is, and to force it to do so would violate MVC,
but is there some other way to accomplish having something like this in a
controller:
2006 Apr 08
2
Cannot use view helpers in RJS helpers
Any ideas why I would get an error in a RJS helper on view helpers
such as number_to_currency.
Example:
# my_template.rjs
page.help_me
# my_helper for my_controller
def help_me
number_to_currency(10)
end
I have also tired page.number_to_currency but that doesn''t work either.
Cheers,
Nicholas
2006 Mar 29
0
Bug with skip_before_filter?
There seems to be a bug with skip_before_filter using the :only or
:except conditionals.
Or am I using them completely wrong?
I have this code:
The result is that :test_filter is skipped for both index, and
index_no_filter.
application.rb
# Filters added to this controller will be run for all controllers in
the application.
# Likewise, all the methods added will be available for all
2007 Apr 01
2
"-" instead of "_" in routes?
Hi all
I''d like to have minus signs "-" instead of underscores "_" in my
routes. Is there an easy to do that?
my_controller/show_something/123 # <= not cool
my-controller/show-something/123 # <= much cooler
Thanks a lot
Josh
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you
2006 Oct 13
0
can you use only with skip_before_filter ?
I have a before_filter in my applicationController (application.rb) for
protecting all pages in my app:
before_filter :login_required
Then in a product controller i have a skip_filter with the only clause
to allow guest users to access that resource.
#allow access to show only if guest
skip_before_filter :login_required, :only => [ :show ]
This worked fine, allowing guest users to view
2006 Dec 29
4
Remote API passing in parameter named 'action', routing loses it
I''m working with a remote API that calls a URL in my app, passing in a
parameter named action. So the request would look like:
http://localhost/my_controller?action=foo
Routing correctly interprets the controller action as index. However,
it sets params[:action] to index as well. I know that''s how it''s
supposed to work...but it means I lose the action parameter