similar to: helpers and controllers?

Displaying 20 results from an estimated 200000 matches similar to: "helpers and controllers?"

2007 Jul 14
2
Using Helpers inside a Controller
I want to use helpers inside a controller method for an AJAX application. After the page is loaded and displayed, there will be an asynchronous javascript request to load additional resources such as html forms and other data. The controller which handles the request will collect the resources and send them back in json format. def get_resources data=Hash.new data[:form1]=form_helper1()
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/.
2006 Aug 04
0
How do you use form helpers in your controllers or classes?
I need to use the number_with_precision Form helper in my controllers and classes. How do i do this? Thanks in advance Chris -- Posted via http://www.ruby-forum.com/.
2010 Apr 01
1
How to improve rails helpers
Hey boys, just wanted to let you know I published a post about ActiveHelper [1] , a framework I released earlier this week to clean- up helpers and put them back to classes using delegation and inheritance. The post [2] studies briefly how rails'' own helpers could be cleaned up with ActiveHelper. Consider it as an RFC, i''m waiting for comments, critics, proposals etc as I really
2006 Apr 23
5
Controllers in folders and helper scope in Rails >1.0
Hi, Here''s my problem. I tried to google it, read the release-docs and haven''t found anything similar. My application uses folders to store controllers, as described in the Rails book. I need to have same-named controllers for admin and for users, so it looks like this: /app/controllers/admin/project_controller.rb /app/controllers/admin/...
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 Aug 14
0
Automatic helpers for controller modules?
Just wondering, is there a way to automatically include helper modules for controllers in modules? Something like (which doesn''t work, so I use ''helper :items): app/controllers/admin/items_controller.rb app/helpers/admin/items_helper.rb Joe -- Posted via http://www.ruby-forum.com/.
2010 Sep 24
0
Rails 3, using helpers in controller
Hi everyone, is there any way how to use Helpers in Controllers in Rails 3? I was trying to google about it, but no luck. In old Rails times (2.x) we were using something like this. my_active_record_object.variable = "This is the message body:<br /><br /> #{@template.simple_format(params["message"])}" point is that when we wanted to attach text from Text Area to
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
2006 Jul 11
0
better way to include helpers into application controller/test_helper?
Right now, I have the following in my application controller - and a simliar version is duplicated in test_helper. There must be a better way to include common functionality like this that gets used across layers? Maybe at the very least a way to include it at the class level and instance level with one line? # provide access to text helper at class level def self.text_helper
2006 Mar 27
3
Define methods for controllers, helper AND models?
Hi all I know that I can define methods in e.g. the application controller and make them available to the helpers using helper_method(), but how can I make them available in the models? I have for example the following method, that I want to be able to call from any model I wish... def ApplicationController helper_method :member def member session[:member] end end Thanks for any
2006 Mar 04
13
Using helpers from controllers ?
There is a solution to use helpers from controllers ? I have an error : |undefined method `content_tag''| class ApplicationController < ActionController::Base def test return content_tag("a","test") end end
2007 Nov 01
0
Using view helpers from a controller
Hi, I want to access a view helper from a controller. (Of course, you all want to know why??? -- See below.) To be specific, I want to access methods such as ActionView::Helpers::FormTagHelper -- form_tag and text_field_tag from either a controller or from a new class (in models? or lib?). If I create the new class then that class''s methods need to also be able to access the
2010 Nov 17
3
How to use request helpers outside of controller specs?
I asked this questions on some other places before, but have found no solution yet. I''d like to include the request helper (from ActionDispatch::Integration::RequestHelpers, like post and xhr methods) also in some specs outside of my controller specs. The problem is that these request helpers are only included in spec/ controller and when a controller is described. What do I have to
2006 Apr 22
1
Newbie question about using helpers in controllers
I''m trying to display a list of pages in xml. I want to change page.update_at to distance_of_time_in_words_to_now. However whenever I run it I get an error saying: undefined method `distance_of_time_in_words_to_now'' I know I can just go the rails api and copy the source, but there must be another way. def list @page = Page.find(:all, :order => "updated_at desc")
2007 Nov 03
1
Specs for Helpers that call render
The helper spec I am writing tests a helper method that calls render. ## module HelperHelper def render_partial render :partial => ''partial'' end end ## The helper spec. ## describe HelperHelper do it "should render partial" do render_partial.should_not == nil end end ## The output generated ## $ spec spec/helpers/home_helper_spec.rb .F 1)
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 Jul 29
1
newbie - best place to put methods used in controllers?
Hey guys, Where is the best place to put methods called in your controller? I ask because my controller file is getting bulky with code that doesnt need to be called directly. I was wondering if I could put it in the application.rb or if there is some way to put it in the helper? -- Posted via http://www.ruby-forum.com/.
2006 Jan 13
0
testing Helpers
[I''m reposting this. The subject wasnt complete and misleading in my initial post (''testing'')] I''m looking for a good way to make all of Rails'' inbuilt helpers available to my custom Helper while I''m testing it. The Helper I''m testing is EditorHelper. EditorHelper itself relies on some of Rails'' inbuilt Helpers, such as
2006 May 23
1
Form Field Helpers... Do they need objects?
I''m trying to use the select helper but do not need to pass the values back to an object because this is just used as a param value. Everywhere I''ve looked I see that the form field helpers require an object name. I''ve tried omitting the name but I get an error telling me I have two few paramaters. (2 out of 3) Other than typing out the HTML myself (because the