I have a typical search facility in my app which returns a list of results that can be paginated, sorted, viewed with a different records_per_page value, etc. Each of these options is controlled by parameters in the query string. A simplified example:
/search?q=test&page=2
Now say I need to display a set of links that set records_per...
Supposedly, ActionController::Base.helpers acts like a proxy for accessing helpers outside views. However many of the methods defined there rely on controller variables and I'm unable to succesfully call:
ActionController::Base.helpers.image_path("my_image.png")
>> TypeError Exception: can't convert nil into String
Digging at the sour...
Hi I am working on a gem that defines a few view helpers and it heavily relies on concat and capture methods but I've recently discovered it doesn't work with HAML (haven't tested thoroughly, but so far doesn't render concat(nated) stuff).
I read somewhere there was a haml_concat version of concat. So If I just need to change my concat ...
This seems like a noob question, but the simple answer is eluding me. I need to call link_to in an ActionController method to spit out an HTML link. ActionView::Helpers::UrlHelper.link_to calls url_for, but this calls the AV module's version instead of the controller's. I managed to coerce this into doing what I intended by putting
#...
Hi all,
There are some Java libraries that do stuff you would otherwise have to put in every single class. For example, I had to put a clone() method in every single class until I discovered Cloner, and I had to put XML handling code until I discovered XStream.
Are there any more similar helper libraries like these?
...
I think in newer versions of Rails, there are ways to say, "share these methods between controllers and views" using something like
controller.helper
controller.helper_method
(I am not sure if they are). But what if these methods are missing in older versions of Rails? How can you tell Rails to share methods between controllers and...
I try to follow this tutorial, but I can't get it to work:
http://weierophinney.net/matthew/archives/246-Using-Action-Helpers-To-Implement-Re-Usable-Widgets.html
I did everything as described, but I don't know how to make it available in my controllers. My filesystem looks like this:
- application
- controllers
- IndexCont...
I have made a helper class called Navigation that gets used on every page because it does stuff to my main navigation menu. So in order for this to work I have included the helper in my pages controller like so:
var $helpers = array('Html', 'Javascript', 'Navigation');
however when there is an error like a missing view or something the...
Hi just need to know whether you can query the database from inside a helper class, whether you should and how you do it.
Thanks
...