Displaying 20 results from an estimated 100000 matches similar to: "components using helpers"
2007 Jul 24
4
spec''ing helpers that use controller
Hi all,
I''m in the process of creating rspecs for my helpers. One of the
helpers in app/helpers/application_helper.rb looks like this:
def page_name
@page_name || "Define @page_name in
#{controller.controller_name}::#{controller.action_name}"
end
The rspec is simply:
it "should something" do
page_name
end
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
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.
#
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:
<%
2006 May 07
0
NoMethodError trying to get ApplicationHelper method from a functional test
I am a little confused by the includes I suspect. In the book, it states
that runtime environment will load the directories app, app/models,
app/controllers, app/helpers, app/apis, components, config, lib, vendor and
vendor/rails/*.
However, when I try to access my "current_project" public method, it fails
with a NoMethodError.
What is even stranger is that I can use reflection to find
2007 Oct 05
1
Custom helpers for list of options?
Hi all,
I have a model that "belongs_to" many other models, many of those
models are just list of names, like country, state, city, profession
... I read about the country_select helper.
Is better to have all those tables or use custom helpers? what the rails way?
Thanks.
For example : http://pastie.caboo.se/104092
# = Schema
# country_id integer
# city_id integer
#
2006 Apr 03
1
Helpers for ActiveMailer templates
What helpers, if any, should be available to a view for ActionMailer? Even
ApplicationHelper methods don''t seem to be available.
This is on Rails 1.0.
David
2006 Jan 01
0
Using standard helper methods in my helpers
Hi... I''ve written some simple helper method. My method uses standard
helper methods from Rails. When I try to use them from templates -
everything is working, but when I try to execute from my helper I get an
exception. Here is my code:
module ApplicationHelper
def reset_add_function
r=update_element_function("add") {
link_to_remote( "Nowy watek",
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 =>
2009 Jun 19
1
[PATCH server] add collapsable sections to vm form
the vm form is getting cluttered, this patch simply add
collapsable sections to the form, making the 'storage'
and 'network' sections collapsed by default
---
src/app/helpers/application_helper.rb | 9 +++++
src/app/views/vm/_form.rhtml | 55 +++++++++++++++++++++++++--------
src/public/javascripts/ovirt.js | 25 +++++++++++++++
2009 Jul 24
2
[PATCH server] add collapsable sections to vm form
the vm form is getting cluttered, this patch simply add
collapsable sections to the form, making the 'storage'
and 'network' sections collapsed by default
credit goes to jayg for contributing alot to
this patch in terms of simplification and cleanup
---
src/app/helpers/application_helper.rb | 4 +-
src/app/views/vm/_form.rhtml | 35 ++++++++++++++++++++++----------
2006 Feb 06
1
Two subdomains with diferent controllers but same helpers and components
Hi,
I want to have www.myproduct.com and myclient1.myproduct.com working on same
server.
I would like to have different controller in wich subdomains, example:
on www I want to have sgnup and prices controller and on myclient subdomain I
want login, settings, etc...
I can open two environments
rails www
rails clients
or point the two subdomains to same environment
rails myproduct
Wich is
2006 Feb 11
7
Menu Helper
Hi all,
I''m trying to add a common menu to all pages in my application. It is
just a set of links I want to display. I''m having trouble deciding
where to put the code. Below is what I''ve tried to get out of the "Four
Days on Rails" tutorial but no luck. Any help would be appreciated. Am
I on the right track?
Thanks,
Sam
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
2007 Aug 27
2
issue with edge rails and urls
I just switched our project over to Edge Rails, and I''m running into
this problem with all of my helper methods that call _url methods:
NoMethodError in ''ApplicationHelper home_link should generate a valid
home link when User.current and Profile.current is not set''
You have a nil object when you didn''t expect it!
You might have expected an instance of
2006 Apr 02
1
Looking for helpers/components/controllers for form wizards
Hi,
In our project, we have a number of forms to be filled by the users. The
forms are presented as wizards - each form as a number of steps. I would
like to know whether there is an existing helper developed by the Rails
community that can let me create wizards easily. We also want all
wizards to have the same look and feel.
Thanks,
Yash
--
Posted via http://www.ruby-forum.com/.
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
2009 Jul 06
0
[PATCH server] UI for accumulated uptime for VMs. (revised2)
This revised version of the patch incorporates jguiditta's sorting fix as well as some other changes required to make this work fully on the cloud UI side.
---
src/app/controllers/pool_controller.rb | 2 +-
src/app/controllers/resources_controller.rb | 4 +++-
src/app/controllers/smart_pools_controller.rb | 7 +++----
src/app/helpers/application_helper.rb | 14
2009 Jul 02
1
[PATCH server] UI for accumulated uptime for VMs. (revised)
This revised version of the patch incorporates jguidditta's sorting fix as well as some other changes required to make this work fully on the cloud UI side.
---
src/app/controllers/pool_controller.rb | 2 +-
src/app/controllers/resources_controller.rb | 4 +++-
src/app/controllers/smart_pools_controller.rb | 5 ++---
src/app/helpers/application_helper.rb | 14
2009 Jan 26
2
Cannot extend class in Application Helper
Looking for some help with extending existing classes.
In a view I have <td><%=h bmevent.node %></td>. I need further
processing on the output and added a helper:
module ApplicationHelper
class String
def a
self[ /^[^\0]*/ ]
end
end
end
and <td><%=h bmevent.node.a %></td> results in an undefined method `a''
for #<String:0xb6c8105c>