Displaying 20 results from an estimated 10000 matches similar to: "Redirect to where I was"
2010 Dec 01
10
How to Redirect from http://mysite.com to https://www.mysite.com on Herok
Hello I''m looking to learn how to redirect all non-www (mysite.com) to
https://www.mysite.com
I tried the following:
class ApplicationController < ActionController::Base
before_filter :check_uri
def check_uri
redirect_to request.protocol + "www." + request.host_with_port +
request.request_uri if !/^www/.match(request.host) if Rails.env ==
2006 Mar 22
7
What is difference between render & redirect methods?
Hi,
Thest are two methods:-
1) redirect_to :action => ''list''
2) render :action => ''list''
what is difference between these two methods??????
Thanks.
Prash
--
Posted via http://www.ruby-forum.com/.
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 May 31
5
Sharing code between some controllers? Staying DRY
Hi,
I have four controllers: one for the store front and three for the
store admin. In each controller I have copied and pasted exactly the
same code. It is a method called redirect_to() to override Action
Controller''s redirect_to(). Copy and paste is bad. I can think of two
options but I don''t know how Rails will feel about them.
Option 1: Can I create an intermediate
2006 Apr 26
10
save new model with child model
Hi,
I am having a problem saving a new model that has an associated child
model. If a new ticket is being created and will have one comment to
go with it then I tried this in my action
@ticket = Ticket.new(params[:ticket])
@comment = Comment.new(params[:comment])
@ticket.comments << @comment
if @ticket.save
@notice = "Ticket added. Thanks for
2009 Aug 06
13
Redirect after login
Hi,
I''m new to Ruby/RoR so please bare with me!
I''m trying to adapt a ruby setup where someone logs in to a bonjour
service via a web browser. I have the login screen which asks for host
and password. There is only one user per host and i can log in fine.
It''s suppose to redirect me to /list in my browser but
doesn''t. Once i''ve entered the correct
2010 Jan 09
5
Redirect 301 and cache
I want my rails app to redirect from no-WWW to WWW domain (for example
if I enter example.com/test to redirect to www.example.com/test). I
put the following code in the application controller and worked fine:
before_filter :check_uri
def check_uri
if !/^www/.match(request.host)
redirect_to request.protocol + "www." + request.host_with_port +
request.request_uri, :status => 301
2006 Mar 20
16
Secret URLs and file downloads
I''m looking to do something similar to the "secret URLs" in Rails
Recipes, however, with file downloads. I want to avoid providing direct
URLs to people if possible.
I have files on disk in public/, so it would be good if each user got a
"unique" URL to each file that they are permitted to see (dealt with by
a user_id/file_id table). Then they are only allowed
2006 Jan 22
6
Destructive behavior with link_to, button_to, :post=>true
Hello-
I would like to know what the suggested practice is for having multiple
submit buttons on a relatively complicated input page.
Let''s use the example of a Contact. There is lots of info there,
including name, address, phone number. There is also a list of "contact
associations" which can be modified on the same page.
Ideally, the user could have one
2006 May 16
2
before_filter and the application controller
Hi there,
I''m having a bit of an issue with my before_filter. I know that the filters
put in the application.rb controller are global for all the controllers. In
my application filter I''d like to allow access to the RSS feed method in a
''member'' controller and skip the login checks that the before_filters are
currently performing.
In my application my filters
2006 Jan 12
17
Application.rb params
I need to check if a parameter is set so that I can build some information
for my application, but No matter how I format my if statement in the file "
Application.rb" it return the following error.
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]
Here is the line
if params[:day]
So we
2006 Apr 17
18
The lone PC in Raleigh
Last week I had the pleasure of attending the Raleigh area Ruby users Meetup.
It was very interesting and very informative.
I did feel a bit out of place when we noticed that of the 11-12 people
there, I was the only one with a PC laptop. The rest were shiny macs.
Ah well, I need to replace this thing soon, and now that BootCamp is
out, I really have no more excuses. This way I can test
2006 Jan 21
9
Where to put method
I''ve got following code in GenresHelper.rb
def album_list(genre)
albums = genre.albums.sort
list = albums.collect { |album| link = link_to album.title,
:controller =>
''albums'',
:action => ''show'',
2006 Apr 11
9
rails equivalent to asp''s Application object?
In asp you have an Application built-in object, which works just like
the Session hash, but it lets you share information among all users of a
given application.
which is the rails equivalent???
and if there isn''t, how would you implement such a thing ? (there would
be concurrency issues to take into account, in fact asp''s application
object has some lock and unlock methods
2006 Apr 23
37
Newbie .. nil object and missing something obvious
Trying to do first project in Ruby on Rails, and I''m getting the dreaded
nil object exception. I''ve reduced the code to what I think is the
minimal case, and it''s still not working. Code presented below..
----------------------------------------------------------------------
in "app/controllers/dashboard_controller.rb"
class DashboardController <
2006 May 16
7
RJS head scratcher
I''ve been joyfully using RJS in a lot of our work lately, with no issues
whatsoever. However, I am porting an application to RJS templates that
we''ve had for a while, and having some issues.
When I use Firebug to see what is going on, the response comes back like
this:
try {
new Effect.Highlight("gi_error_row",{duration:20});
} catch (e) { alert(''RJS
2006 Feb 16
10
Ruby class variables and access from view templates
I have an app that requires me to define a class variable (actually an
array) in a controller and then access it from within a view. It seems
that the class variables aren''t working right. Here is an example of
what I''m trying to do.
class DisplayController < ApplicationController
@@thumbnail_array = Array.new
...
def some_method
@@thumbnail_array = SomeModel.find_all
2006 Apr 18
6
Best Practice for Returning to Calling Page?
I have a partial, it''s a shopping cart display, it''s designed to appear
on several different pages of my site.
One of the buttons on the shopping cart empties the cart, and then I
want the calling page to redisplay.
In other words, the cart controller needs to return the visitor to the
same page -- however since the cart could appear on any given page, this
has to be
2006 Apr 25
5
Authorisation question
My authentication (signup/login) is up and running in my app, now I need
to implement an authorisation system. Its not going to be a complex
one. One admin (me) and then normal members and premium members. Any
tutorials or tips on a simple way to get this running? Thanks.
--
Posted via http://www.ruby-forum.com/.
2006 Apr 02
5
Showing current user''s information and saving
Hi,
I am logging users in and keeping them in session. The problem I am
having is showing only a certain logged in user''s information.
In the Adverts_Controler:
def show
@advert = Advert.find(params[:id])
end
I am also having issues with saving an advert for an user:
def create
@advert = Advert.new(params[:advert])
if @advert.save
flash[:notice] = ''Advert