Questions tagged [helpermethods]
86 questions
1
vote
1 answer
nest helper methods in rails3
I would to nest some helper methods to simplify my application_helper, for example I have a bunch of methods dealing with currencies which apply for the entire app and I would like to put in the currencies_helper and then simply include that entire…

holden
- 13,471
- 22
- 98
- 160
1
vote
2 answers
Recursive Method to find number of occurrences of UpperCase letters in string- Using helper method
I'm trying to create a recursive method to find the number of occurrences of an UpperCase letter in a String. My code below:
public class findUppercase {
public static int searchUppercase(String s, int high) {
if (s.length() == 1) {
if…

Ari K
- 434
- 2
- 18
1
vote
1 answer
How set up and call a rails method in the view to update an attribute of an object
I need some help in figuring out how to set up a helper method and then call in in the view. What i need to do is update a single attribute of a model object.
How I plan to do this is to call a helper method Bid, which will update the attribute by…

Clay McCullough
- 69
- 8
1
vote
2 answers
Recursion in helper methods (Java)
I am practicing recursion and using a recursive helper method. In my helper method, an error appears saying that
The method someMethod(K) in the type Tree is not applicable for the arguments (K, List, int).
However, I do not want to use the…
user4060080
1
vote
1 answer
Problem with returning values from a helper method in Rails
I want to print some objects in a table having 2 rows per object, like this:
Name Price
Content 123
I wrote a helper method in products_helper.rb, based…

True Soft
- 8,675
- 6
- 54
- 83
1
vote
1 answer
rails application controller method is undefined in children
I'm having a slight issue.
I have the following controllers set out like so:
class ApplicationController < ActionController::Base
attr_accessor :perms
helper_method :set_permissions
def set_permissions *permissions
self.perms = permissions
…

Thermatix
- 2,757
- 21
- 51
1
vote
2 answers
suggest helper method for this Java Generics piece of code please
I accidentally wrote this piece of code .
static List foo(List fillthis,List super Integer> readlist){
for(Object i:readList){
if(i instanceof Integer)
fillthis.add(i);
}
return fillthis;
…

Sarabjeet
- 264
- 2
- 17
1
vote
1 answer
Helper methods are not being seen (Rails 4 engine)
I have defined a helper method as such (for my rails engine):
module Xaaron
class ApplicationController < ActionController::Base
protect_from_forgery with: :null_session
rescue_from ActiveRecord::RecordNotFound, :with =>…

user3379926
- 3,855
- 6
- 24
- 42
1
vote
4 answers
Recursive helper method
i cant find the right solution for this exercise, here is the task:
(Occurrences of a specified character in an array) Write a recursive method that
finds the number of occurrences of a specified character in an array. You need to
define the…

Peter
- 409
- 2
- 6
- 14
1
vote
2 answers
StackFrame.GetMethod().Name
I'm using this helper to resolve the name of the method that is currently being executed for logging purposes.
[MethodImpl(MethodImplOptions.NoInlining)]
public static string GetCurrentMethod()
{
StackTrace st = new…

g5insider
- 109
- 9
1
vote
1 answer
How to use "count" in rails to show how many projects/tasks user has?
I defined method 'count' in my tasks controller as:
def count
@count = current_user.tasks.count
end
I'm not sure how to show that in my tasks views. Do I just use Tasks count: <% @count %>? How do I get in my view how many tasks the user…

sent-hil
- 18,635
- 16
- 56
- 74
1
vote
3 answers
Editing world-flags output
I am trying to edit the output on the world-flags gem, in the documentation it says the following:
You can customize the output by the flag view helper methods:
WorldFlags.flag_list_tag = :div
WorldFlags.flag_tag = :span
WorldFlags.flag_text =…

Jeremy Lynch
- 6,780
- 3
- 52
- 63
1
vote
3 answers
How to organize helper functions
I need to create lot of helper routines for converting strings.
Something like :
String Function1(String s) {}
I would like to call them from any Activity.
What is the best way to do this ? Do I need to create a class or not ? I was thinking just…

MRB
- 422
- 1
- 8
- 16
1
vote
1 answer
link_to links not working in other views after using devise
I'm working on a rails app that uses devise.
I added other models to the app and the links in those new views (default "link_to") are not working. For example, I scaffolded a new model and the links for those views do not change the URL (hard…

pvskisteak5
- 4,162
- 3
- 24
- 26
0
votes
2 answers
CSS style time_ago_in_words rails
I was wondering what would be the best solution for customising the rails helper: time_ago_in_words, so that I could do things like:
4
hours
ago
or what the…

Darcbar
- 888
- 1
- 8
- 25