Displaying 20 results from an estimated 10000 matches similar to: "change in routes broke variable ?"
2006 Feb 07
0
scope problems testing a helper method that calls link_to()
We''ve been having problems writing functional tests for helper methods
that rely on ActionView methods. Here''s a specific example.
In application_helper.rb I''ve got a method called ''party_link()ยจ:
def party_link(party)
link_to party.full_name, { :controller => ''contacts'',
:action =>
2005 Mar 17
2
Using gettext to localize your rails app
Hi,
I am having some trouble finding out how best to use ruby-gettext in my
app. I do this in my ApplicationController:
before_filter :localize
private
def localize
# we will always use UTF-8
@charset = ''utf-8''
@headers["Content-Type"] = "text/html; charset=@charset"
# simplified approach: extract the first language from the request
# or use
2007 Jul 31
11
helper spec not finding rails core helpers
Hi,
My helper specs were going ok until I added a call to a rails
DateHelper method in one of my helpers
http://api.rubyonrails.com/classes/ActionView/Helpers/
DateHelper.html#M000574
The helper runs fine from my view templates, just dies in the spec test.
I boiled my question down to a simple (not too useful) example. I''m
not sure what I''m missing.
#
2008 Jan 29
0
ActionMailer calling shared methods
I''m trying to use a shared method from an ActionMailer template. The
method was originally in ApplicationHelper, but I''ve also tried it in
the base controller (application.rb), with and without
helper_method. In all cases, I get an error
undefined method `wgg_replace_crlf'' for #<ActionView::Base:0x324b230>
Here is the relevant block of code from the email
2007 Aug 18
0
Tests for render when changing view_paths
Hi there,
I''ve been getting into RSpec recently and I must say what a fantastic
product I think it is. But, I''ve hit a bit of a problem. In my
ApplicationHelper I have a method which changes the view_paths in a
controller so a partial can be rendered from a different base
directory. It simply takes an array of view_paths that a partial
could be in, updates the
2008 Oct 31
10
Strange dependency error after going Ruby1.8.6, Rails 2.1.0 -> Ruby1.8.7, Rails 2.1.2
Hi,
I''m getting an error I just can''t find any cause for.
The error is "A copy of ApplicationHelper has been removed from the
module tree but is still active!" and gets thrown
in a Template that uses a method defined in my ApplicationHelper. The
error occurs only in development mode.
The error did not occur before my switch to Ruby 1.8.7 and Rails 2.1.2
minutes ago.
I
2008 Mar 19
3
ApplicationHelper
When working with views, I use instance methods of ApplicationHelper:
# app/helpers/application_helper.rb:
module ApplicationHelper
def distribute(total, min, cutof, list)
[1,2,3]
end
end
# app/views/planner/_mta_colors.rhtml:
<td>
<%
...
dist = distribute(total_v_px, 4, 0, colors.collect{|color| color[1]})
...
%>
So to test the distribute method in ApplicationHelper, I have
2006 Feb 06
2
basic usage confusion
I am confused. Looking at ''list'' from scaffold, I see a record and click
the ''show'' button. I put in a ''link'' at the bottom of ''show.rhtml'' to my
''view'' rfn2.rhtml - action = ''rfn2'', :id = @placement
I click this link and get error...
log/development.log
Processing
2006 May 21
6
Is there a way to call helper methods in a controller?
Hi,
Is there a way to call helper methods in a controller?
I want to do something like this in my controller
Class MyController < Action....
def my_method
string = link_to "some_url", :controller => "home", :action => "command"
end
end
link_to is an ActionView helper method and it seems that I couldn''t access
the method in the controller
2007 Dec 09
0
Writing Specifications for Custom Form Builders (and Helpers)
Hello all,
Long time reader, first time poster!
I am a relative newcomer (no idea what on earth I am doing) to Ruby,
Rails and Rspec and have a feeling I am probably trying to run before
I know how to walk.
I had imagined a cool way of outputting a div around some form stuff
which would have a class on it if the related field had errors,
something a bit like:
<%
2010 May 18
0
ruby-recaptcha seems be broken or has significant limitation
I''ve installed the ruby-recaptcha gem as instructed here:
http://bitbucket.org/mml/ruby-recaptcha/wiki/Home
Here are the steps that I''ve comleted:
1. installed the gem
2. added config.gem ''ruby-recaptcha'' environment.rb:
4. modified action_controller.rb
class ApplicationController < ActionController::Base
include ReCaptcha::AppHelper
5. modified
2010 Nov 29
0
[TDD] [Rails] - Rspec test for application_helper.rb fails when trying to access application_controller method.
In a method named logo in my application helper, I reference an application controller method (current_account) that has been marked as a helper method with the following syntax:
helper_method :current_account
When I test out the setup in the browser (without rspec), rails is happy with this setup.
However, when I run the spec, the spec won''t pass and gives me the following error:
2008 Dec 07
0
boolean button helper
I don''t have a blog, but wanted to share this little bit of code with
other semi-beginners like myself who are still learning to take
advantage of rails features.
Selecting an attribute with a boolean switch is a common pattern in
forms. You can do it with a check box, but radio buttons are more
expressive in some situations and better convey to the user that they
are making a mandatory
2005 Oct 10
0
[BUG ??] 'uses_component_template_root' problems with implementation in component
Hi all,
I hope this will reach those that can help or change things, IF it is
a bug/''feature'' issue. At least it seems like it to a newbie like me.
BACKGROUND::
I have a basic html file in [ /app/views/layouts/application.rhtml ]
that contains this
<html>
<%= render ''shared/header'' %>
</html
I then have a component [
2006 Apr 18
1
''wrong number of arguments'' for text_field?
This is probably something very simple but I can''t seem to figure out
why I keep getting the ''wrong number of arguments (1 for 2)'' error with
the following code when I try to create a new record. If anyone can see
what is going wrong here please help!
new.rhtml
-------------------------------------------------
...
<%= start_form_tag :action =>
2006 Oct 18
1
New to Mocha
Hi all
I am new to Mocha. I am trying to use it for my pet rails project.
I seem to be getting loads of errors when I add mocha as a plugin. It
seems to be conflicting with TinyMCE plugin http://johnwulff.com/
articles/2006/05/31/tinymce-with-ruby-on-rails
I am getting the following errors
ActionView::TemplateError: undefined method `using_tiny_mce?'' for
2009 Oct 07
2
Rails, flash, function and parameter
Hi,
I try do update the flash on my page with ajax.
I have this on my layout :
<div id="flash_messages">
<%= render :partial => ''layouts/flash'' %>
</div>
I have this on my ApplicationHelper :
def reload_flash
page.replace "flash_messages", :partial => ''layouts/flash''
end
and I try do that on my controller :
2007 Aug 11
2
Rspec and acl_system2 plugin
Hello,
I''m trying to spec a Rails application using the couple
restful_authentication/acl_system2 plugins.
In my admin layout, I put the following code :
<% restrict_to "admin" do -%>
<ul id="admin-tabs">
<li> /users Users management </li>
</ul>
<% end -%>
Then in my spec file
2006 Jan 16
1
Problem with production on Dreamhost - TemplateError
Hi all,
I''m trying to deploy my app to Dreamhost for production. I''ve managed to
solve all of the Error 500s and it''s *almost* working.
When I try and view a page, I get a TemplateError that I don''t get when
I''m running from home using InstantRails under Windows.
The error is:
ActionView::TemplateError (undefined method `user?'' for
2010 Nov 04
0
Re: Train wreck getting render_to_string to work from foreign controller [SOLVED]
Just for collective knowledge as I have found no info on this problem
online:
I solved this by adding an .html.erb file for the "missing template", since
by design or bug Rails3 will not find or render another controllers view (in
my experience). Then in the new html.erb file, I just put <%= render
"comparisons/display" %> because the views *are* able to find templates