helper

How do I test that a Rails Helper defines a method?

I am creating a Rails plugin and it is dynamically adding a method to a Helper. I just want to ensure that the method is added. How can I see if the Helper responds to the method name? ...

What is the best way to return multiple tags from a Rails Helper?

I want to create a hidden field and create a link in one helper and then output both to my erb. <%= my_cool_helper "something", form %> Should out put the results of link_to "something", a_path form.hidden_field "something".tableize, :value => "something" What would the definition of the helper look like? The details of what link_t...

How do I test Rails block helpers with rSpec

In my views I use a helper that takes arbitrary HTML as a block: <% some_block_helper do %> Some arbitrary HTML and ERB variables here. More HTML here. <% end %> My helper does a bunch of things to the passed block of HTML before rendering it back to the view (Markdown and other formatting). I would like to know what are the clean...

A good library to do URL manipulation in Java

I need to do a few very simple URL manipulations in Java. Like get the value for a parameter in the query, or update it, ... I was expecting to find a simple utility class doing that in the commons-lang package, but no. I know it is a simple problem, but if there is something already written, why do it again ? Do you know of any ? I wou...

Is it possible to load a Rails helper at run time?

I have a View that can vary significantly, depending on the 'mode' a particular user has chosen. I thought I would extract the different behavior into two different Helpers, and then have code like this in the Controller: class MyController < ApplicationController case mode when 'mode1' helper "mode1" when 'mode2' helper "mode2" e...

When to use Helpers instead of Partials

In a rails application, in which situation would you use a partial and when would you use a helper? I find both very similar, since they represent markup fragments. Is there a convention around this? which is the 'rails way' of using them? Thanks! ...

Looking for DependencyProperty.Register shortcut.

Defining WPF properties is too long: public static readonly DependencyProperty FooProperty = DependencyProperty.Register("Foo", typeof(string), typeof(FooClass), new PropertyMetadata("Foooooo")); I have a helper method, making it a bit shorter: public static readonly DependencyProperty FooProperty = WpfUtils.Property<string, Foo...

Where do I put 'helper' methods?

In my Ruby on Rails app, I've got: class AdminController < ApplicationController def create if request.post? and params[:role_data] parse_role_data(params[:role_data]) end end end and also module AdminHelper def parse_role_data(roledata) ... end end Yet I get an error saying parse_role_data is not defined...

Remove ":" from the ruby on rails time_select helper output?

I want to remove the ":" from the output of the rails time_select helper. The helper seems to output this automatically when the minutes select box is built. Any ideas? Thanks! ...

How can I improve a rails helper method with a config file?

I have a rails helper in my application_helper.rb file that looks like this: def external_link(name) url = external_links[name] if url.blank? Rails.logger.error "No URL defined for external link [#{name}]!" return "[URL undefined]" end return url end The 'external_links' variable is a hash that should b...

How to use PHP inside JS files (with Symfony)?

I found this: http://www.symfony-zone.com/wordpress/2008/12/13/use-routing-to-server-localized-and-dynamic-javascript/ But I saw that it has already been built into Symfony with the use_dynamic_javascript() AssetHelper. I can't find any documentation for using this helper though. Any examples, links, or anything to help? Thanks. ...

What are helper classes and scripts?

In a lot of frameworks/AMS/CMS I see folders of "helper" scripts and classes. What exactly do helper scripts and classes do? What is their specific purpose. Is that defined by the developer or is their a standard for their function? ...

In Symfony, how can I use the url_for helper in a class?

I am building a URL inside of a class and I'd like to be able to change the routing if necessary later by just changing the routing.yml file. If I have the route: userSignup: url: /user/signup param: { module: user, action: signup } How can I use the url_for('userSignup') helper in a class to dynamically create the URL? ...

Active Directory Helper Class

Hi, Is there a Active Directory Helper Class available somewhere? Just checking before I re-invent the wheel. I need to Validate a user in AD. Get hhis/her member roles. Thanks ...

(Ruby, Rails, Javascript) Drag and Drop without bugging the server...?

Hi All, Is there an equivalent of "link_to_function" (instead of ":action") when using "draggable_element"? Basically I need to drag and drop some items and have it reflected locally without contacting the server. My current setup is that I have two DIVs with various list items. I have one full of items with domids "points[selected][...

How do I create a helper with block?

...

Why shouldn't C#(or .NET) allow us to put a static/shared method inside an interface?

Why shouldn't C#(or .NET) allow us to put a static/shared method inside an interface? seemingly duplicate from here. but my idea is a bit different one, I just want to put a helper for my plugins(interface) shouldn't C# at least allow this idea? namespace MycComponent { public interface ITaskPlugin : ITaskInfo { stri...

How to Write JQuery in Helper on Rails

Please Help how to write JQuery coding in Helper function on Rails. ...

rails: fields_for select

In a view that I have, I am using fields_for to display form data for a relational table. However, part of this form will have select lists to choose from. I see there are label, text_field, text_area helpers for the form_for and fields_for helpers that will fill in the info needed from an already populated model object... but what abo...

Rails: installing & running Textile Editor Helper

I'm trying to get a Textile Editor Helper on my Rails site. I installed the latest version from git, installed it and now trying to get things running. I put the code: <p> <%= f.label :message %><br /> <%= f.textile_editor :message -%> </p> but Rails return an error, pointing I don't have a proper method: undefined method `tex...