Displaying 20 results from an estimated 800 matches similar to: "Strange error: undefined method `rewrite''"
2006 Feb 01
4
Where is the send() function?
Hi,
in the tutorial "4 Days on Rails" the following code fragment is used:
,----
| <% for column in Category.content_columns %>
| <td><%=h category.send(column.name) %></td>
| <% end %>
`----
Apparently, the send() function returns the column value by name, but
where does this function comes from? Unfortunately, neither the tutorial
nor the API
2006 Jun 08
5
Field names in validators
Hi!
Is there a (simple) way to use alternative field names in validation
messages? For example, if I have a validator like this one:
validates_presence_of :email
how can I make it print a message like "E-Mail Address can''t be blank"
instead of "Email can''t be blank"? I can override the "can''t be blank"
part by using the :message
2006 Jul 12
3
How to get the current URL?
Hi,
how can I get the current URL withing a controller? There seems to be no
appropriate method in ActionController::Base.
I''m creating a site, which requires a login for some pages. I''m using
before_filter for authentication. My idea was to store the currect URL
in a session before redirecting to the login page and then redirect to
this URL after successful authenfication.
2007 Aug 30
1
alias_method_chain stack level too deep in Rake test only
I have an odd error. I have the following module:
module ActionController
module SslSupport
def self.included(base)
raise "#{base} does not define url_for" unless
base.method_defined?(:url_for)
unless base.respond_to?(:url_for_without_ssl_supprt)
base.send :include, InstanceMethods
base.send :alias_method_chain, :url_for, :ssl_support
end
2006 Feb 27
0
Mapping '':action/:id/:controller/'' doesn''t work
Hello People,
(I am not good at ROR yet. This post could be very lame.)
I am going playing with routes.rb.
Well, pretty much any combination of mapping works, a part from:
map.connect '':action/:id/:controller/''
In this case, the request is routed; however, I get:
---------------------------------------
Showing app/views/inputs/start.rhtml where line #8 raised:
No url can be
2016 Jul 16
1
Problem with cloud-init on re-boot
When I re-boot my CentOS 7 machine I get lots of error/warning messages
like the following:
------------------------------
Jan 1 14:39:04 alfred cloud-init: 2016-01-01 14:39:04,351 -
url_helper.py[WARNING]:
Calling 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed
[2/120s]:
unexpected error ['NoneType' object has no attribute 'status_code']
2006 Mar 13
1
issue with redirect_to
Hi all:
I can''t make redirect_to to unlock the current iframe using {:TARGET =>
"_top"}. It always stays in the current frame. I checked the
redirect_to code, it seems the method does not use "target". here is the
source code of redirect_to from ActionController::Base
def redirect_to(options = {}, *parameters_for_method_reference) #:doc:
753: case options
2008 May 24
1
link_to_remote, image_tag, mouseover is this possible?
Hi guys,
I was wondering if you are able to have a link_to_remote, having an
image_tag and the link_to_remote has a mouseover event that updates a
div. Does the image_tag need the mouseover event? I currently have:
<%= link_to_remote(image_tag(@p_image.public_filename(:thumb)), :update
=> "big_pic", :onmouseover => {:action => :color_change, :id =>
@p_image.id})%>
2006 Apr 21
9
Capistrano, OS X
If you installed your copy of ruby via DarwinPorts, the hashbang lines
at the top of your dispatch.* scripts says "#!/opt/local/bin/ruby". This
is a problem, if you''re deployin via Capistrano to a host with a
different path to ruby (which would be practially all of them:-)
Here''s a fix. Add this "fix_hashbangs.rb" script to your script
directory.
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
2007 Dec 23
1
Rails: possible routing discrepancy
Hey all, I''m seeing a strange behavior in my spec that I can''t
account for. I''ve got a route that looks like this:
map.writing \
''/writing'',
:controller => ''abstracts'', :action => ''index'',
:index => { :select => ''all'' }
and I have template code that looks like this:
<br
2006 Apr 07
6
Magic Field Names - "position"
What does the Magic Field Name position do?
I was looking here:
http://wiki.rubyonrails.com/rails/pages/MagicFieldNames
And unfortunately that documentation is incomplete.
Thanks.
--
Posted via http://www.ruby-forum.com/.
2007 Feb 21
6
Problem with url_for and https - overrides all options
I have a piece of code like this in one of my views:
<%=link_to "link here", :action=>''my_action'', :id=>1 %>
It works fine on my local development machine, running Webrick over http
and it works fine on my testing server which is running single mongrel
instance behind Apache 1.3 as a proxy. On both the outcome link is this:
<a
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 25
4
dynamic set_table_name for achives
How can I pass something to set_table_name so that I can switch tables
on the fly for accessing archive data?
If I could access sessions inside a model I would do something like:
if @session[:current_period]
set_table_name "statistics_" + @session[:archive_year]
else
set_table_name "statistics_" + Date.now.year
end
But since I cannot access the session from within a
2006 Feb 21
2
ActiveRecord before_ callbacks question
Hi!
I need to set the primary key in a model and postgres table to something
different than id. View Edit and such works in the scaffolded
controller. However if I click in the controller below the list of data
onto New then I get an error message like this:
Showing app/views/admin/_form.rhtml where line #5 raised:
undefined method `nr_before_type_cast'' for
2006 Feb 15
5
dispatch.cgi error affecting specific browsers
I have a rails app that is accessed through Apache 2 (just using cgi
now; will add fastcgi later when everything is working).
The app works fine with some os/browser combos at my work site:
windows/IE
Mac/safari
Mac/firefox
Linux/firefox
But it fails on windows/firefox and my colleague''s (at a different site)
mac/safari (we are running the same os version and version of safari)
The
2007 Nov 20
3
How to test views with Nested Resources and Partials
Hi everyone,
I am relatively new to rspec and I am running into a wall in testing my
views. I have a RESTful resource Contracts with a nested resource of
Line_items.
I am trying to figure out how to test the "edit" form of the Line_items.
What complicates this is the nested routing and how to account for it,
and that there is a partial form (_form.haml) that both the edit.haml
and
2008 Jul 02
3
Crashing after Update
Hello All!
I''ve been running Rails 2.0.2 with Ruby 1.8.6 for the last six
months. I developed an application that runs fine on two different
servers -- or at least, it used to.
I used Mongrel as a development server, but requirements called for
using Apache for a production deployment. I found Phusion Passenger
(mod_rails) and decided to give it a try.
I decided to update my rubygems
2006 Aug 04
5
image_tag + ActionMailer
Hi,
Any idea why image_tag doesn''t work within an email template? I''m trying to
generate the URL for an image and I''m getting the following error.
undefined method `request'' for #<Mailer:0x6a719e0>
I''ve been able to use link_to but no luck with image_tag.
I''ve seen a similar post to this in the list but no one has posted a
response.