Questions tagged [actionviewhelper]

For questions about helper classes for the Ruby on Rails module Action View.

For questions about helper classes for the module .

86 questions
2
votes
3 answers

content_for are not rendering in partial views

I have a rails app which uses a layout The simplified version looks like this: <%= render 'layouts/head' # renders the "layouts/_head.html.erb" partial correctly # the most head (css/js) content…
Jan
  • 12,992
  • 9
  • 53
  • 89
2
votes
0 answers

After updating rails 2.3.2 to 2.3.15 destroys scandic charset

We have problem with scandic charset. We have localization file as *.yml and database which contains also some localization. Problem is that when we use Actionview helper it destroys scandic charset by removing characters from the string. If we use…
joonasj
  • 551
  • 2
  • 6
  • 19
2
votes
3 answers

Show missing I18n translations in views

As stated in ActionView's documentation, the t view helper in Rails automatically mangles missing translations. Eg: irb> helper.t('words.foo_bar') => "Foo…
nickh
  • 4,721
  • 2
  • 29
  • 31
1
vote
1 answer

Is it possible to just update Rails form input field value using turbo frames?

Let's say I have a form built with Rails form builder. It has a text field, and I want to dynamically update the input field's value using AJAX and turbo streams. Is it possible to update the same text field's value without replacing it with a newly…
1
vote
1 answer

Rake task with both Active Record and View Helpers

I would like to apply ActionView::Helpers::NumberHelper#number_with_precision method to an attribute of an object of my (Active Record) model within a Rake task. I’d hoped this would work (but it errors, full trace below): desc 'test if helpers…
Dan SimBed
  • 133
  • 1
  • 11
1
vote
0 answers

Calling a block from the view inside a helper using `link_to`

In this fictive but representative example, we want to create a Rails 7.0 view helper that takes a block, feeds the block a magic word, takes the block's output and produces a link pointing to some path, displaying the block's output as the…
Kalsan
  • 822
  • 1
  • 8
  • 19
1
vote
3 answers

Passing path to current_page method

I have a helper method to help to determine whether or not a navigation menu item should be active/inactive. def events_nav_link nav_item = 'Events' if current_page?(events_path) # additional conditions here # do nothing else …
keruilin
  • 16,782
  • 34
  • 108
  • 175
1
vote
0 answers

Issues rendering view with flash.now and form_with element

In a Rails 7 controller create action I want to render the :new action/view if the model.save action fails. My initial code looked like this; def create new_city = City.new(params.require(:city).permit(:name, :prefecture_id)) respond_to do…
1
vote
1 answer

Rails - content_tag for table cell with rowspan

How would you translate this into a Rails content_tag? glah
keruilin
  • 16,782
  • 34
  • 108
  • 175
1
vote
1 answer

Rails collection_select prompt appears on initial page load, not thereafter. Any fix?

Rails 2.3.11. I have a search form like this... - form_for(@search) do |form| # bla bla bla = form.collection_select(:Location_eq, Contract.all_locations, :first, :last, {:prompt => '-- Select --'}, {:class => 'ff'}) When…
Ethan
  • 57,819
  • 63
  • 187
  • 237
1
vote
1 answer

Zend action helper redirector

How to redirect in models or not in contrroler? use standart zend redirector helper $redirector = new Zend_Controller_Action_Helper_Redirector(); $redirector->gotoUrl('/');
victor
  • 31
  • 1
1
vote
2 answers

Rails: Views: content_tag helpers

I have a controller which does the following line before rendering the view and outputting an error. flash[:error]="Flash error" flash[:info] = "Flash info" I would like to format this nicely. For that I wrote a helper which looks like this def…
Jay Godse
  • 15,163
  • 16
  • 84
  • 131
1
vote
0 answers

Why isn't `:escape => false` supported by all ActionView tag generators?

I need to generate a hidden input element with ActionView::Helpers::FormTagHelper#hidden_field_tag, but I don't want the input value to be escaped. What I would like to do is this: <%= hidden_field_tag('hidden_input', sanitize('actual_input_value'),…
Kyle McVay
  • 488
  • 3
  • 13
1
vote
1 answer

How to include ActionView::Helpers in rails controller?

Following is my code. class PropertyDetailsController < ApplicationController include ActionView::Helpers #Action methods. end But the above code is throwing following error when I try to run. Module::DelegationError…
Praveenkumar
  • 921
  • 1
  • 9
  • 28
1
vote
0 answers

view_helper time_field without am/pm and with seconds

Is there any standard form input in rails 4 with a mask to receive time in the following format: mm:ss? where the minutes section may be greater than 60. I'm trying with the view_helper time_field, but I couldn't find a way to remove the am/pm and…
fabraz
  • 45
  • 1
  • 5