Displaying 20 results from an estimated 70000 matches similar to: "Accessing raw get/post?"
2006 Jun 22
3
attr_boolean, a good idea?
Hello all,
I''ve recently been working with a model with a lot of boolean
attributes and I decided that it''s worth trying to implement a
attr_boolean function to cut down on the work. Something like
class User < ActiveRecord::Base
attr_boolean :contact_by_email, :display_real_name, :administrator
end
which would replace the hand written
class User <
2006 Jun 16
0
rake spec controller test output hideus.
Is there any way to change the output of rake spec fails?
The errors are just totally over the top ugly and not helpful. First
of all the ruby -Ilib line always comes before each test and I find it
distracting. But if an error occurs on something that is not nil it
just gives me the entire contents of that object and that is no small
matter when the object is a HTTP request response.
Here is
2006 May 23
1
Validating a required relationship.
Hello,
I''m not sure if I''m missing something blindingly obvious here.
All the relationships that Rails comes with assume 0..n, yes? It''s
not a strict 1 to 1 or 1 to n because it''s optional. My question is
this -
What is the best way to implement a required relationship?
For example, if I require that a comment is made by a user (a user
has many
2006 Jul 19
1
Testing the flash is brittle?
Hello all,
I seem to have an annoying habit of realizing that I''ve asked a
question with a blindingly obvious answer just after I''ve asked it
but here goes.
I''ve noticed that in my functional tests there''s the occasional
reliance on the contents of the flash. For example, I have an action
that confirms a users identity and may reject them because
A)
2005 May 21
0
How can I get a post-Routing translated url_for?
Is there a way to ask the Route system what controller and action
mapping will be used, given a hash containing :controller and :action?
I am trying to generalize the case where there is a button bar (e.g.
tabbed pages) having one image shown if you are presently visiting
that page, and another shown if you are not presently visiting that
page (e.g. an "active" and an
2008 Sep 16
0
POST parameters incorrectly appended to REQUEST_URI
My rspec controller tests are appending POST params to the request_uri
as though they are GET variables.
So this line:
post :create, :foo => ''bar''
Generates a request_uri that looks like this:
my_restful_controller?foo=bar
However when performing the same action from the actual application, the
params are not appended to the request_uri (as expected).
Looks like this
2006 Jun 06
1
Redirect\Cookie bug with MSIE 5.5sp2
Hello all,
There seems to be a bug in internet explorer 5 where a redirect
causes the session to be lost.
A controller says....
def login
case @request.method
when :post
if @session[:user] = User.authenticate(@params
[:user_login], @params[:user_password])
return redirect_to(:action=>''send_confirmation'') unless
2007 Jun 18
0
login pre-filter and post data problems
Hello Folks,
I am trying to use a standard sort of login controller, whereby you
put a pre-filter on the pages on which you want the user to have to
login. This is all well an good, except for one thing. Here is some
code to save the original request uri before redirecting to the logon
page.
def authorize
...
session[:original_uri] = request.request_uri
logger.info("ApplicationController:
2006 Jan 08
4
Redirect to where I was
I wonder if there is a standard Rails way to redirect from an action
back to a previously viewed page. As a quick fix I created two little
methods in the controllers/application.rb. Does this seem like an ok
way to go?
Thanks,
Peter
class ApplicationController < ActionController::Base
def i_was_here
session[:i_was_here] = request.env[''REQUEST_URI'']
end
def
2007 May 30
0
Headers munged into RAW_POST_DATA
Hi,
we''re seeing a really weird problem in our production environment.
"Connection: Keep-Alive\r\n" is being pre-pended to the RAW_POST_DATA,
which makes requests error out. This bug is seen infrequently and
*seems* to be browser-related, although I can''t reproduce it using the
browser reported in HTTP_USER_AGENT.
Set up is a apache 2.2 -> hardware load balancer
2007 May 29
1
Headers munged into RAW_POST_DATA
Hi,
we''re seeing a really weird problem in our production environment.
"Connection: Keep-Alive\r\n" is being pre-pended to the
RAW_POST_DATA, which makes requests error out. This bug is seen
infrequently and *seems* to be browser-related, although I can''t
reproduce it using the browser reported in HTTP_USER_AGENT.
Set up is a hardware load balancer (NetScaler)
2008 Jun 05
2
how to add a method without coding it directly into app?
i''m missing something here.
how would I code this outside the application to be shared with other
Camping apps?
module Blog::Controllers
module AuthenticationHelper
def self.included(base)
class << base
define_method :authenticate do |*a|
a.each do |meth|
if method_defined?(meth.to_s)
2010 Apr 21
4
Accessing the router from a helper
I find manually accessing the router to be quite ugly below. Is there
a more direct way to access it?
module ApplicationHelper
def menu_item text, url = nil
routes = ActionController::Routing::Routes
url = if url
if url.is_a? String
url
else
routes.generate url
end
else
routes.generate :controller
2006 Apr 04
1
integration tests - 1.1
I?m using the new 1.1 integration test facility? I?m trying to write a
test that sees if a controller redirects to the correct place and
preserves the query string.
Here?s the code:
class LoginRedirectTest < ActionController::IntegrationTest
def test_non_admin_auth
request_uri = "/datafeed/event/report?blah=blah"
get(request_uri)
follow_redirect!
2008 Jul 06
2
How to Auto Add forward slash "/" when accessing a link/url through ProxyPass
Hi Friends,
I am using Centos 5.2 and using ProxyPass to access applications
running on other servers. Everything is working fine except for one of
the applications I need to auto add forward slash when any user tries
to access that application. For ex
ProxyPass /testdiary http://testdiary.example.com/
ProxyPassReverse /testdiary http://testdiary.example.com/
If somebody
2013 Jan 10
0
TCPSocket in controller action
Hi,
in order to stream a file I am making use of TCPSocket. Unfortunately I
dont receive contents when in use the tcpsocket in a rails controller
action while it is working on console.
url = "http://www.google.de"
version = request.env[''HTTP_VERSION'']
verb = request.env[''REQUEST_METHOD'']
# url =
2007 May 05
1
Asterisk 1.4.4 and Custom Postgres 8.2.4 (checking for PQexec in -lpq... no)
Dear All,
Why does my configure fail like so:
checking for pg_config... /usr/local/pgsql/8.2.4/bin/pg_config
checking for PQexec in -lpq... no
configure: ***
configure: *** The PostgreSQL installation on this system appears to be broken.
configure: *** Either correct the installation, or run configure
configure: *** including --without-postgres
Configure options are:
env CC=/usr/local/bin/gcc
2003 Oct 15
1
FW: Re: domain groups accessing samba share
-----Original Message-----
From: VR-Bug Support
Sent: 15 October 2003 13:42
To: 'Gavin Davenport'
Subject: RE: [Samba] Re: domain groups accessing samba share
Hi Gavin,
This is what I have for my /etc/pam.d/login
#%PAM-1.0
auth required pam_securetty.so
auth sufficient /lib/security/pam_winbind.so
auth sufficient /lib/security/pam_unix.so nodelay
2008 Nov 05
3
Problems w/ before_filter getting ignored
Hello,
I''m setting up an authentication module that will be called from
application.rb. I want to save a rrequest.request_uri into a
session to be used as a place holder that
will take users back to the page they were on before they logged in.
I''m trying to call the store_location method for all methods EXCEPT
login by putting login in an except before filter.
For some
2006 Dec 28
0
HTMLDOC PDF Generation
Okay. I''ve tried it all, or so it seems. The code:
generator = IO.popen("htmldoc-no-compression -t
pdf14-quiet-jpeg-path \".;http://#{request.env["HTTP_HOST"]
+ request.env["REQUEST_URI"]}\"-webpage -", "w+")
generator.close_write
send_data(generator.read, :filename => filename, :type =>
"application/pdf")
I basically