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
4
votes
2 answers

difference between sanitize and strip_tags rails

Exactly I don't know the difference between these. I read this http://api.rubyonrails.org/classes/ActionView/Helpers/SanitizeHelper.html but don't get the exact difference. Could anyone let me know the difference?
Sourabh Upadhyay
  • 1,034
  • 11
  • 31
3
votes
2 answers

Rails number_to_currency precision doesn't work - is it a bug?

I'm trying to use number_to_currency to get two digits after the decimal dot in Rails 3, but I can get only one. My DB field is defined like this: t.decimal "amount", :precision => 5, :scale => 2 In my template I…
iRonin
  • 470
  • 4
  • 12
3
votes
1 answer

Rails yield and content_for wieird behaviour, `yield :filter` only work if placed after default yield

Lets say i have this partial i am trying to render #layouts/_subheader.html.erb
<%= yield %> <%= yield :filters %>
when i use this partial in a view like this <%= render 'layouts/sub_header' do %>

3
votes
1 answer

Rails - How would I get the URL of a single image asset in the controller?

I've tried including ActionView::Helpers::AssetTagHelper and then using the image_path() method however it gives me grief: undefined local variable or method `config' for ActionView::Helpers::AssetTagHelper:Module There's probably something simple…
digitalWestie
  • 2,647
  • 6
  • 28
  • 45
3
votes
2 answers

How to render images in rails3 select

I want to render dropdown list in form with images as options. How to achieve this in rails3?
Achaius
  • 5,904
  • 21
  • 65
  • 122
2
votes
1 answer

Undefined method 'url_for' while rendering a Rails 2.3.x template inside a ActiveRecord model

I know that this not an "acceptable" practice but as a background process I am caching a rendered Rails partial into the database for faster output via JSONP. I have found many resources on the topic and successfully output a Rails 2.3.x partial…
ACuppy
  • 21
  • 1
  • 4
2
votes
1 answer

How do I use form helpers in the mailer in rails 3?

I am trying to create a mail to users which includes a simple html form. For this I am using ActionMailer from Rails 3 as suggested in the tutorial at http://edgeguides.rubyonrails.org/action_mailer_basics.html#example-action-mailer-configuration I…
A.K.
  • 3,593
  • 1
  • 17
  • 19
2
votes
1 answer

form_with not displaying remote true since rails 5.2

Since upgrading Rails from 5.1 to 5.2, form_with is not defaulting to remote: true, although it was in rails 5.1 How to default to remote true?
Nicolas Maloeuvre
  • 3,069
  • 24
  • 42
2
votes
2 answers

Access ActionView::Helpers::DateHelper from class defined in /lib directory

I have an EmailHelper class defined in /lib/email_helper.rb. the class can be used directly by a controller or a background job. It looks something like this: class EmailHelper include ActionView::Helpers::DateHelper def…
Daniel Bonnell
  • 4,817
  • 9
  • 48
  • 88
2
votes
4 answers

How can I allow tags through rails 4 sanitize?

I've been using the sanitize method in a Rails 4 app to scrub a page which displays html that users generate to prevent unsafe things like script injection. So I have a view that looks like: sanitize @user_input Right now I'm having issues when…
slykat
  • 856
  • 1
  • 11
  • 18
2
votes
2 answers

Set rails highlight to match only entire words

I'm using highlight method to mark words in texts. So, my problem is when i try to highlight little words that can be "sub-words" than others. Ex.: highlight("a estimativa de tempo", ["tim", "oi"]) And the highlight returns: "a…
2
votes
1 answer

Rails 4.2: Retrieve Files without Extension ( collection_check_box )

I have a list of pdf files passed through and displayed by Rails collection_check_box method... <%= f.collection_check_boxes :upload_ids, Upload.where(file_type: ".pdf"), :id, :file_name do |b| %> <%= b.label do %> <%= b.check_box + b.text…
shroy
  • 918
  • 2
  • 10
  • 24
2
votes
1 answer

url helpers not using host name in Capybara feature test

In my spec I use AssetUrlHelper: include ActionView::Helpers::AssetUrlHelper so that I can test a page that should display an absolute URL to one of my files. I thought asset_url should do the trick: asset_url(img.img_file(:medium)) Unfortunately…
iftheshoefritz
  • 5,829
  • 2
  • 34
  • 41
2
votes
1 answer

Issues with rails4 and mongoid on production mode

I am working with rails 4.2.x and Mongoid . I am getting the following error when I try to run server in production mode ,but it runs smoothly on development mode, not sure why I am getting this error . I tried precomipling asses but no luck. =>…
ratnakar
  • 352
  • 1
  • 11
2
votes
2 answers

Difference between render 'posts' and render posts (without quotes)

I was going through a video and where he was rendering something like below example:
<%= render posts %> # no quotes to posts
Though he has even created a partial with _posts.html.erb, he is calling with quotes to posts. Though he…
Rahul Dess
  • 2,397
  • 2
  • 21
  • 42