search for: applicationhelper

Displaying 20 results from an estimated 110 matches for "applicationhelper".

Did you mean: application_helper
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 met...
2006 Mar 25
3
Rails Plugins: Why to register your own functionality with send()?
Hi there, I have seen in the file column plugin ( http://www.kanthak.net/opensource/file_column/) from Sebastian Kanthak or David''s acts_as_taggable plugin that to register my functionality I need to do something like this: ApplicationHelper.send(:include, InPlaceEditAssociations) I am wondering why not: (a) module ApplicationHelper include InPlaceEditAssociatons end or: (b) ApplicationHelper.include(InPlaceEditAssociations) As I now know a way that works this is not crucial to me, but I am still curious. Cheers, Mariano ------...
2009 Apr 12
4
Can't get an Array function to be visible inside ApplicationHelper
Folks, I seem to be missing something basic here. I am trying to call a function from my application layout that will return me a hash of the roles for the user currently signed in. Here is the simplified code I have in ApplicationHelper module class Array def to_h Hash[*enum_with_index.to_a.flatten] end end def get_cur_user_roles ["school_admin", "General2"].to_h end I call get_cur_user_roles from my layout file. When I bring up the web page I get an error that says undefined metho...
2006 Sep 29
2
ApplicationHelper is not a parent of SomeHelper?
i have: # file application_helper.rb module ApplicationHelper def load_components @right_sidebar = ''some stuffs'' end end # file user_public/blog_helper.rb module UserPublic::BlogHelper def load_components ApplicationHelper.load_components @right_sidebar += ''{blog archive}'' end end the problem is, i wan...
2011 Apr 08
5
How to extend a helper using plugin?
...ed so far exposes this behavior: the first render of a page uses the extended version, while every later renders use the original unmodified helper. I''ve tried to include my patch module in the plugin''s init.rb like this: require_dependency ''application_helper'' ApplicationHelper.send(:include, RedminePastebin::ApplicationHelperPatch) Also I''ve tried to define my ApplicationHelper in myplugin/app/helper/ application_helper.rb with the same effect. Both approaches used self.included hook to call alias_method_chain, like this: def self.included(base) base.mo...
2006 May 07
0
NoMethodError trying to get ApplicationHelper method from a functional test
...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 that the method is indeed there. For instance, this code: def test_should_login_and_redirect ApplicationHelper.public_instance_methods.each do |method| if method == "current_project" puts "calling " + method puts ApplicationHelper.send(method) end end ... Will find the method but then when it is called, it will still complain yeilding: Loaded suite test/...
2006 Mar 12
1
alias_method interferes ApplicationHelper
...r (must_fill and rp or number_to_currency_rp) in application_helper.rb ? I doubt that alias_method is the culprit, but if i give # comment then there will be no errors at all ... :/ what am i doing wrong? is it a bug or stupid me? Thx ------------------ This is my helper: ------------------ module ApplicationHelper alias_method :rp, :number_to_currency_rp # Rp 1.907.000,00 instead of $1,907,000.00 def number_to_currency_rp(dolar) number_to_currency(dolar, {:unit => "Rp ", :separator => ",", :delimiter => "."}) end def must_fill(x) ''<span s...
2010 May 19
2
customized form_for in ApplicationHelper
hello, I want to make a table within a form by making a new form_tag. The following code in ApplicationHelper fails: def tabular_form_for(name, object = nil, options = nil, &proc) concat("<table>", proc.binding) form_for(name, object, (options||{}).merge(:builder => TabularFormBuilder), &proc) concat("</table>", proc.binding...
2006 Feb 12
7
form_remote_upload plugin
form_remote_tag does not support the input type=file. This is due to javascript security limitations. I created a plugin that modifies form_remote_tag so that if you pass it the option: :html => {:multipart => true}, it will submit via an iframe, allowing you to upload files. It works nicely with file_column :). Currently, it only works with RJS templates (no :update option), and I only
2007 Jul 31
11
helper spec not finding rails core helpers
...tp://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. # application_helper.rb module ApplicationHelper def app_foo t = Time.now distance_of_time_in_words( t, t + 50.minutes) return true end end # application_helper_spec.rb require File.dirname(__FILE__) + ''/../spec_helper'' describe ApplicationHelper do it "should find app_foo in application_helpers.r...
2008 Nov 07
0
Error: A copy of ApplicationHelper has been removed from...
Hello. I just started getting this error but can''t figure out what I did in the past day that might be causing this: "A copy of ApplicationHelper has been removed from the module tree but is still active!" Apparently, there are others that have seen this -- gathering from a google search -- but I can''t find any solution. Has anyone seen this? Here is what I''ve done recently: 1. Added ssl plugin 2. Added a couple aut...
2009 Mar 21
2
ApplicationHelper::WillPaginate (NameError)
...18n(collection, options.merge(:previous_label => I18n.t(:previous), :next_label => I18n.t(:next))) end alias_method_chain :will_paginate, :i18n /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:440:in `load_missing_constant'': uninitialized constant ApplicationHelper::WillPaginate (NameError) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39...
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 Array. The error occurred while evaluating nil.<< ./spec/helpers/application_helper_spec.rb...
2006 Feb 09
4
Login_Engine: trouble configuring
Hi Guys, I''m having some trouble getting login_engine to work. I''ve followed the steps in the README file to the letter (I think) with the exception of the Mailer stuff and cannot get my application to run. Heres what I have; module ApplicationHelper include login_engine end ##################################### require ''login_engine'' class ApplicationController < ActionController::Base include LoginEngine helper :user model :user before_filter :login_required end ################################...
2006 Jun 21
0
Action Mailer and ApplicationHelper method
Hi, sorry if this has been asked before, but I couldn''t find any info. Is it possible to use application helper methods in ActionMailer templates (or methods, in case this is the only way)? All I found is one statement in the agile web development book, that ''the regular helper methods, such as truncate(), are available''. Is there any overview which helpers are
2006 Feb 26
0
rescue_action with RoutingError not loading ApplicationController/ApplicationHelper
Why is it that when rescue_action is called with any exception except for RoutingError, "self" refers to a controller within my application, but when there''s a RoutingError, "self" refers to an object of ActionController::Base? This makes some sense because a "RoutingError" implies that no controller was found to process the request. However, I am trying to
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> error. What am I doing wrong? The helper is correctly found, since module ApplicationHelper def b(text) tex...
2007 Jul 24
4
spec''ing helpers that use controller
...roller_name}::#{controller.action_name}" end The rspec is simply: it "should something" do page_name end Running ./script/spec spec/helpers/application_helper_spec.rb produces: F 1) NameError in ''ApplicationHelper hmmmm'' undefined local variable or method `controller'' for [RSpec example]:#<Class:0xb70de334> /path/trunk/config/../app/helpers/application_helper.rb:21:in `page_title'' ./spec/helpers/application_helper_spec.rb:6: ./s...
2006 May 29
2
How to use script/runner
...ing script/runner I''ve gotten simple model functions similar to the -help example to run: $script/runner ''puts Vendor.find(1).name3'' where Vendor is a model. However when I try to run a function in a controller it doesn''t work: $script/runner ''puts ApplicationHelper.money(100)'' script/runner:29: undefined method `money'' for ApplicationHelper:Module (NoMethodError) I''m sure there is a simple solution to this. More generally, does script/runner look in every class in the application to try and find the referenced class? -- Poste...
2006 May 13
1
undefined method `strftime'', being called from a partial.
Hi, I''m having an issue with calling a function that I''ve defined in ApplicationHelper called format_time: module ApplicationHelper def format_time(time) time.strftime("%a %b %d, %I:%M%p") end end I use this function in my views to format the Time.now that I would have stored in my tables as a DATETIME. I''m able to use this function, without any issues...