Displaying 20 results from an estimated 200 matches similar to: "issue with redirect_to"
2010 Oct 26
2
Formatting durations
Hi,
I am working with a dataset for sometime and I need some help in parsing
some data.
There is a column called "Duration" which has data like following:
2 minutes => 120
2 min => 120
10 seconds =>10
2 hrs =>7200
2-3 minutes => 150 or 120
5 minutes (when i arrived => 300
Flyby approx 20 sec. => 20
felt like 10 mins but tim => 600
I need to convert them to
2010 Aug 09
0
Expanding tests with own methods
I want to call the method ''url_for'' in my functional test.
e.g. assert_select "a[href=?]", url_for(:action => :new), :text => ''Neue
Seite''
The book I am reading suggests doing this:
class PagesControllerTest < ActionController::TestCase
def setup
def self.url_for(options, *parameters_for_method_reference)
options.merge! :only_path
2005 Nov 29
0
undefined method `link_to'
Hi, all I''m trying call link_to from another helper
but got this error:
undefined method `link_to'' for module `UserHelper''
how can I get access to helper from another helper? this is my
users_helper.rb:
module UsersHelper
alias ink_to_original link_to
alias link_to link_to_permission
def link_to_permission(name, options = {}, html_options = nil,
2006 Mar 07
0
Webrick Timeout Problem
I posted this to the ruby on rails google group, but this forum is
probably a better place to find the answer.
I''m going through the ''how to make a blog in 15 minutes'' tutorial on my
ibook right now. I have mysql, ruby, and rails all setup, and the
tutorial was going smoothly until I tried to configure the database.yml
file. I create a mysql user and gave him
2008 Jan 30
1
undefined method `scaffold'
Hello,
I have been busy for a while and now I am back to messing with rails.
Last time I tried to use scaffold i worked now I am getting this error.
Not really sure since I am using version 1.2.5 still
NoMethodError in BlogController#index
undefined method `scaffold'' for #<BlogController:0x506eb7c>
Session dump
flash: !map:ActionController::Flash::FlashHash {}
Thanks for any
2006 Aug 03
1
Why doesn''t redirect_to handle rjs?
Is there a good reason why redirect_to doesn''t check responds_to, so
it can handle redirects in rjs calls? I''ve done something like this
in my app controller, seems to work ok...
alias_method :redirect_to_orig, :redirect_to;
def redirect_to(options = {}, *parameters_for_method_reference)
respond_to do |accepts|
accepts.html do
redirect_to_orig
2006 Jun 26
0
Action caching with params
I was attempting to cache an action that had a URL like this:
http://foo.com/controller/action?years[]=2005&years[]=2006&bar=5&baz=blue
which returns different data than, say
http://foo.com/controller/action?years[]=2004&years[]=2005&bar=6&baz=red
However, the cached fragment would always be named
foo.com:3000/controller/action.cache, no matter what parameters where
2006 Mar 12
2
Strange error: undefined method `rewrite''
Hi,
when I generate a new rails project with a simple scaffolded controller,
I get a strange error message, whenever it tries to call the url_for
method, for example:
,----
| undefined method `rewrite'' for #<Url:0xb7675e64>
|
| Extracted source (around line #7):
|
| 4: </p>
| 5: <% end %>
| 6:
| 7: <%= link_to ''Edit'', :action =>
2006 Jan 11
5
stack level too deep problem
Hi all, I''m trying to overload the link_to function, (to disable link_to if
the user has no access right)
this is my code, it work the first time I run the application, the second
time I refresh the page I always get "stack level too deep error"
module UsersHelper
include ActionView::Helpers::UrlHelper
alias_method :link_to_original, :link_to
def permission?
true
2006 Dec 31
2
what''s with the response.should_be_xxxx stacktrace?
If I do
get :index
response.should_be_success
I get about 20k of marshalled dumpage that starts like
#<ActionController::TestResponse:0x390443c @body=\"<html><body>You
are being <a href=\"http://test.host/carts/1\">redirected</a>.</body></html>\",
@assigns=[], @redirected_to={:action=>\"show\", :id=>1},
2009 Jan 19
1
in functional test, assert_redirected_to w prefix
I had to use sub-URI deployment (could not use subdomains..), and when
running my functional tests, I the redirected_to assertion embed the
prefix.. quite normal ;-))
is there a way to stipulate this prefix in the test setup to avoid
hard-coding in all the tests ?
Expected response to be a redirect to <http://test.host/my/page>
but was a redirect to
2005 Dec 23
2
has_many and belongs_to relationship error
Hi i am getting following error
ActiveRecord::StatementInvalid in Blog#index
Showing app/views/blog/index.rhtml where line #10 raised:
Mysql::Error: #42S22Unknown column ''posts.user_id'' in ''where clause'':
SELECT * FROM posts WHERE (posts.user_id = 4)
Extracted source (around line #10):
7: <div class="separator"> </div>
8:
2007 Aug 27
2
Can FILTERS AND VERIFICATION functions take arguments?
Hi,
I have some problems in using filter. My filter functions need to have
arguments, but filter functions take only symbol that refer to
function name. Consider the following code:
class BlogController < ApplicationController
before_filter :authorize
For instance, authorize need arguments. So how can I pass arguments to
filter function?
Any helps always appreciate.
2006 Jan 29
2
GetText and rjs templates?
hi,
is it possible that gettext don''t work with rjs templates?
i''ve just tried this simple example
blog_controller.rb :
class BlogController < ApplicationController
def index
end
def dosomething
end
end
index.rhtml :
<html>
<head>
<%= javascript_include_tag :defaults %>
</head>
<body>
<div id="test">Some text to change
2008 Apr 15
4
ActiveRecord::StatementInvalid in BlogController#index
Hello. I''m trying to do the video tutorial "how to build a blog engine
in 15 minutes with ruby on rails" from the main rubyonrails website,
and I''m getting an error when I try to use scaffold :post after
editing my config file for the mysql database.
Here is the exact error I''m getting:
ActiveRecord::StatementInvalid in BlogController#index
2006 Jan 03
1
Passing parameters with link_to
I have following code in my controller:
class AlbumsController < ApplicationController
def list_by_year(year)
@album_pages
@albums = paginate :albums,
{ :per_page => 10,
:conditions => ["year = ?", year] }
render :action => ''list''
end
end
Now I want to make a link to the list_by_year action in
2006 Apr 04
1
Calling a method in another controller
Hi,
I have three controllers. I have defined two controllers to goven the
site functions. However I want to have a homepage Controller. Part of
the controller will call methods from other controllers. For example it
will get the last 5 blog posts and it will get the top 5 most discussed
articles, and display it on the homepage. I will also have some
specific homepage modules being
2006 Mar 25
0
in_place_collection_editor
Hi,
I''m trying to write a helper for Scriptaculous'' InPlaceCollectionEditor
component. I''ve already submitted a patch
(http://dev.rubyonrails.org/ticket/4302). This was a drunk patch; it
needs a bit of work (Don''t drink & code!). So far I''ve gotten it to work
correctly with normal collections, but I want to use it for belongs_to
relations as
2009 Oct 13
0
RSpec, flash messages and redirection
Hello everybody
I''m having some problems with RSpec.
1) When using something like "I should see ''some text''"
that text is set on a flash message in the controller and displayed by
= flash[:notice] in the layout view, so the relevant part of my view
says, in haml:
.notice
= flash[:notice]
The rspec evaluation for that says:
response.should
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