Displaying 10 results from an estimated 10 matches for "my_help".
Did you mean:
r_help
2006 Nov 16
2
Stubbing helpers
...for dev purposes I''d like it to return some hardcoded
html. I''m not having any success stubbing the helper out. Something
like...
test/mocks/development/helper_stub.rb
require ''application_helper''
class ApplicationController < ActionController::Base
def my_helper
"<div>Hard-coded stuff</div>"
end
end
Can this be done? Thanks,
--Trevor
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, s...
2013 Feb 03
4
Create a helper for models and views?
Hi!
If I have a method that is useful in both models and in views, where would
be the appropriate place to put it?
The method in question just takes two dates as strings, tries to parse them
and returns all dates in the range between them. It also takes care of the
issues when the dates are badly formatted etc etc..
This method is being used in several models (so a simple class method in
2006 Apr 19
8
Module and Model
I am getting the following error
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1129:in
`method_missing'': undefined method `directory?'' for Msg::File:Class
(NoMethodError)
I have a model called Msg::File in models/msg/file.rb, and I have a file
in lib/msg/helper.rb which references to both Msg::File and
File.directory?
How do I help activerecord
2006 Apr 08
2
Cannot use view helpers in RJS helpers
Any ideas why I would get an error in a RJS helper on view helpers
such as number_to_currency.
Example:
# my_template.rjs
page.help_me
# my_helper for my_controller
def help_me
number_to_currency(10)
end
I have also tired page.number_to_currency but that doesn''t work either.
Cheers,
Nicholas
2006 Jun 07
6
Links on the left hand side - are components necessary?
Hello,
Maybe this is super-trivial...
I need to have a list of links on the left hand side of my application,
for *every* single page.
So, I''ve created a layout called "main" (main.rhtml) under
view/layouts, and included >layout "main"< in pretty all of my
controllers.
main.rhtml has, amongst all the other HTML stuff:
<%= render_component
2006 Mar 20
0
Using render within plugin.
I am very, very new to rails (and ruby) and am working on a view
extension helper method. In a template I have
<%= my_helper params %>
my_helper does some system calls and ends up placing an image file in
the public images folder (which I referenced within the plugin using
RAILS_ROOT). I want the helper to then return an appropriate image link
to the template. I want to use the image_tag method to do so, or at...
2007 Jul 14
2
Using Helpers inside a Controller
I want to use helpers inside a controller method for an AJAX
application. After the page is loaded and displayed, there will be an
asynchronous javascript request to load additional resources such as
html forms and other data.
The controller which handles the request will collect the resources and
send them back in json format.
def get_resources
data=Hash.new
data[:form1]=form_helper1()
2006 Aug 16
4
Accessing Constants Declared in Helper Modules
Hello all,
I''m having great trouble accessing a constant declared in a helper for
one of my view templates. I am trying to create a grouped selection list
based on a predefined set of values. Rather than declare this set of
values in the view, I wanted to put it in the helper that automatically
gets included for the view. Unfortunately, it doesn''t seem to work.
All methods
2006 Mar 01
0
TextHelpers in Controller?
...ject_note.body = simple_format(@project_note.body)
Since this happens in a controller, I guess it''s not kosher to use
viewer code, and Rails doesn''t let me. (Some interesting discussions
back from January 05 in the mail archives). I see lots of examples of
how to use helper :my_helper in a controller, with MY own generated
helpers, but how can I use the core API TextHelper suite?
err... and is there an opposite to simple_format, that converts <br>s
into line returns? regex would be simple enough of course, but if
somebody already wrote it into the API... (Yes, I did...
2007 May 21
4
Just upgraded to 1.0.0, should render_text isn''t working for me
I finally got around to upgrading from 0.8.2 (!!). I had a spec which
looked like
specify "should render abc123" do
controller.should_render :text => "abc123"
get :key
end
With 1.0.0, the new spec is
it "should render abc123" do
get :key
response.should render_text("abc123")
end
However it doesn''t work, giving me the error:
undefined