Questions tagged [actionview]

For questions about Action Views, HTML and Ruby templates used in Ruby on Rails

HTML and Ruby templates used in .

Action View is the View part of for , and is a part of the Ruby-On-Rails Action Pack.

490 questions
1
vote
2 answers

Rails3 sanitize escape HTML rather than remove

Is there a way to have the ActionView::Helpers::SanitizeHelper#sanitize method escape the offending HTML rather than just completely removing it? I would use h but I need the sanitize method because you can set it to ignore certain tags.
user545139
  • 935
  • 11
  • 27
1
vote
1 answer

Getting 'undefined method `view_paths=' for # Did you mean? view_paths' error using PDFKit in Rails

I'm using PDFKit (along with the Gem render_anywhere and wkhtmltopdf-binary) to create a button for creating PDF's from HTML in Rails. I've followed a couple tutorials that both use 'invoices' as an example. My app uses 'audits'. I thought I'd…
Demian Sims
  • 871
  • 1
  • 14
  • 29
1
vote
1 answer

How do I render an SVG inline in Rails?

I have an SVG file that's part of a template located at: vendor/theme/assets/icons/icon-1.svg How do I render that inline in my view? render partial: path fails and says it can't find a partial.
Amin Shah Gilani
  • 8,675
  • 5
  • 37
  • 79
1
vote
0 answers

Does the `cache do` block belong in the calling template or the called template?

What is the convention for where the cache do block goes? Does it belong in "calling" template or the "inner" template that the "outer" template renders? In some examples, I see the responsibility for caching a template B going in the "parent" or…
Tyler Rick
  • 9,191
  • 6
  • 60
  • 60
1
vote
1 answer

Rails Custom ActionView::Template::Handler no data sent

I'm trying to create a template handler for CSV in rails 5.2.3 When I render anything through the template, all i get is "Network Error" for the file with no data sent I can't seem to find ANYTHING on the net about how instance variables are passed…
Sampson Crowley
  • 1,244
  • 1
  • 9
  • 22
1
vote
0 answers

Not able to use INTENT_VIEW in android pie it 's showing nothing

I am making an application which uses intent to call all the application in the device with UPI. My code works fine before Android Pie but, in android pie it's showing nothing. Here is my code: intent.setAction(Intent.ACTION_VIEW); …
A.Pant
  • 27
  • 1
  • 9
1
vote
1 answer

How can i use If method on Button getting ActionView link from realtime database, and if there's no link give toast message there's no link

I'm using Firebase RealTime database, and using retrieving data, I'm asking about if I want to add If method on OnClick() for the button and get the ActionView link from real time database, and if there's no link in the database give a toast message…
1
vote
2 answers

Link_to not working?

Alright, either I need to go to bed or change careers. An incredibly simple link_to is failing and I just can't see where. #routes.rb resources :wikis #view.html.haml = link_to @wiki.title, wiki_path(@wiki) Errors with: No route matches…
Matt Darby
  • 6,294
  • 4
  • 27
  • 35
1
vote
1 answer

An image_path is showing up along with image uploaded

while I upload the image the image a paragraph of unwanted text is showing up below the image. here is a screenshot the view file has the following code:
  • <%= link_to gravatar_for(project.user, size: 50),…
  • spd_25
    • 27
    • 4
    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
    1 answer

    Error from inside ActionView::Template::Error - String can't be coerced into Integer

    We recently updated the ruby and rubygems versions of our app, and we've been consistently getting the following error: A TypeError occurred in [model]#[view]: String can't be coerced into…
    1
    vote
    1 answer

    Rails: how can I force no value for a form_for text field for a model that has that field populated?

    I have this form: =form_for @current_user, :url => update_password_path do |f| %label{:for => ""} * New Password =f.password_field :password, :value => "" But when the current user has a password, this field is populated on the page despite…
    James
    • 5,273
    • 10
    • 51
    • 76
    1
    vote
    1 answer

    How do I access ActionView's fields_for index when iterating over many child records?

    I have a Rails 2.3.10 app that uses fields_for to include fields on a has_many association's attributes. I'm using accepts_nested_attributes_for on the the parent model and its many children are being shown in the form using: <% form_for :map do |f|…
    nutcracker
    • 2,944
    • 2
    • 17
    • 16
    1
    vote
    5 answers

    Template is not found by Rails

    Rails 5.1 In my controllers/fw_exports_conttroller.rb, I have: def import_spreadsheet @import_spreadsheet = FwExport.new render template: "fw_exports/_import_spreadsheet" end When I select the menu item for this controller action, I get the…
    EastsideDev
    • 6,257
    • 9
    • 59
    • 116
    1
    vote
    1 answer

    Include blank option on a condition in select

    I have to display list of countries which can be rated. If a country has already been rated then users cannot "unrate" it # countries index = render @countries # countries/_country = form_for country do |f| = f.select :rating, …
    Hirurg103
    • 4,783
    • 2
    • 34
    • 50