helper

Rails form.text_field getting undefined method while rendering view

Hi there I'm trying to run the following code: <% form_for :user, :url => {:action => :welcome} do |f| %> <table> <tr> <td align="right"><%= f.label :name %></td> <td><%= f.text_field :name %></td> But I'm getting "undefined method" when I try to run it using cucumber/webrat, while rendering the page. Running on the web brow...

help with jquery ui.helper[0] = null in IE6

i'm trying to use jquery to implement a portlet/widget style interface, with 3 columns and drag and drop within and between them. it's working almost completely, except for issue that it doesn't work in IE6 (function($) { $.fn.portlet = function() { return this.each(function() { $(this).sortable({ connectWith: ['.por...

What's the convention for extending Linq datacontext with set based helper operations specific to one collection of entities only

Hi All I might be vaguing out here but I'm looking for a nice place to put set based helper operations in linq so I can do things like; db.Selections.ClearTemporary() which does something like db.DeleteAllOnSubmit(db.Selections.Where(s => s.Temporary)) Since I can figure out how to extend Table<Selection> the best I can do is crea...

My helper methods in controller

My app should render html, to answer when a user clicks ajax-link. My controller: def create_user @user = User.new(params) if @user.save status = 'success' link = link_to_profile(@user) #it's my custom helper in Application_Helper.rb else status = 'error' link = nil end render :json => {:status => status, :li...

Java NetBeans Comments Class Diagram Helper

i am starting to learn Java using Netbeans 6.8 IDE. i am wondering if there is a utility in NetBeans similar to VS2008 that facilitates commenting code and later display these comments in class diagrams? thanks. EDIT: i found the Javadoc feature. it is some help but not that great. ...

Access $Sesssion from helper in cakephp

hello folks. a cakePHP newbie here.... I have created a custom helper. I need to get a session value in this helper and i need to get some data from a table. How i can make these things possible. I have tried var $helper=array('Session'); but then also when i use $this->Session->read('userid'); it returns error Undefined pr...

Protection from downloading videos when using flowplayer.

Hello I'd like to make protection of the videos on my site and make them harder for downloading ... so they must be hidden for apps like DownloadHelper etc. I'm using flowplayer and I don't have a clue, how to do it. Any help will be useful - thank you. ...

How can I change the tags/css class of some dynamic text based on output from a helper?

I have a repeated line which outputs something like: Call John Jones in -3 days (status) I have a helper called show_status(contact,email) which will output whether that particular email had been sent to that particular contact. If it is "sent," then that entire line should show up as "strike out." Similarly, if the number of days i...

Factoring out conditional from Rails view

I have a line of code in a basic Rails blog application I did that determines whether the suffix to the number of comments should be "comment" (if 1) or "comments" (0 or 2+) Currently, it is a line in the view looking like this: <%= post.comments.count() %> <%= post.comments.count() == 1 ? "comment" : "comments" -%> However, sinc...

Rails: Easiest way to provide file downloads?

G'day guys, currently have almost finished writing a rails application that allows a CSV download of the database. This is generated when the index is first viewed. Is there an easy way to insert a link to a helper that returns a CSV document? That is to say is it easy to insert links to helpers? This would make a lot of problems I've ...

Multi level menu, active links css highlight. (Ruby on Rails)

Site structure: / /products /products/design /products/photo /about I want to see parent menu item also highlighted by CSS, when child is active. (When 'design' or 'photo' is active 'products' should be highlighted too.) I'm using this for child and simple urls: <li class="<%= current_page?(:action => 'design') %>"> <%= link_to...

how to call a helper method from controller in rails?

I created a helper method for some simple calculation. This helper method will just return an integer. I need the helper in both controllers and views. Unfortunately, it work well in views but not in controllers. I get the undefined local variable or method error. How can I fix it? Thanks all ...

Using a helper method in a mailer that is defined in a controller

The helper method current_user is defined and made available as a helper in ApplicationController like this: class ApplicationController < ActionController::Base helper_method :current_user def current_user return @current_user if defined?(@current_user) @current_user = current_user_session && current_user_session....

how to return clean javascript from a rails3 custom view helper?

Using Rails 3: In my update.js.erb file I found I was repeating a lot of stuff. So I tried to put it all into a helper. But I'm having trouble getting the helper to give back clean javascript. It puts in \&quot; everywhere instead of " Here's what I started with: <% if @list.show_today %> $("#show_today_check_<%= @list.id %>").rem...

Using Helper $time->niceShort with german settings in CakePHP 1.2

I want to use the CakePHP Helper "time" and his method niceShort to transform a date into a nice, easy to read one. Instead of the english default transformation I want to use a localized version (in my case: "german") but I don't know where to set this. How can I localize this method? echo $time->niceShort($comment['created']); ...

Guidelines for calling controller methods in helper modules?

Few questions: Is it possible to call a controller method in a helper module (e.g., application helper)? If so, how does the helper handle the rendering of views? Ignore it? In what instances would you want to call a controller method from a helper? Is it bad practice? Do you have any sample code where you're calling controller method...

How to make HTML Helpers that supports generic type?

public static class EmptyOrNullHelper public static string EmptyOrNull(this HtmlHelper helper, IQueryable(T) type) { //Code } } ...

Rails complex routing, easier named routes helpers

I have a named route like the following: map.with_options :path_prefix => '/:username', :controller => 'questions' do |q| q.question '/:id', :action => 'show', :conditions => { :method => :get } end Now to generate a URL to a specific question I have to write question_path( :id => @question.id, :username => @question.user.usernam...

iPhone: Helpful Classes or extended Subclasses (Categories) which should have been in the SDK

This is more a community sharing post than a real question. In my iPhone OS projects I'm always importing a helper class with helpful methods which I can use for about every project. So I thought it might be a good idea, if everyone shares some of their favorite methods, which should have been in everyones toolcase. I'll start with an ...

Are there any drawbacks to using helper :all in Rails

In Rails 'helper :all' makes all your helpers 'available' to all your controllers. This is concise and convenient, but does it have any memory and/or performance implications compared to explicitly calling the helpers that each controller actually needs? It's unclear form the docs whether using it involves 'require'ing all those files,...