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
2
votes
1 answer

ruby on rails: ActionView::Template::Error (no implicit conversion of Bignum into String) when use form_for

I have a problem with form_for on Ruby on Rails, using Ruby 2.0 and Rails 4.0.0. I followed this tutorial, everything went perfect until i added the form_for. When I open the sign up page, it throws: Completed 500 Internal Server Error in…
Manuel
  • 21
  • 1
2
votes
4 answers

rails/ruby - how to rescue ActionView::TemplateError

i am testing an application built with rails and from time to time get bugs when it happens, ActionView::TemplateError occurs and gets logged in log/production.log how do i catch it and f.ex. send myself by email whenever it happens somewhere in the…
Pavel K.
  • 6,697
  • 8
  • 49
  • 80
2
votes
1 answer

Is it possible to get a list of available layouts in rails (including those from engines)?

I'm allowing admins to choose a different layout for their page. Right now it's just a text input and they type the name in. This means they have to know the name in advance. If they make a typo it would raise an exception, so I am checking the…
2
votes
3 answers

Rails 2 Render ERb template in controller?

This code in the controller av = ActionView::Base.new(Rails::Configuration.new.view_path) av.extend ApplicationHelper content = av.render(:file => "show", :locals => { :user => @user }) and the show.html.erb have the link_to helper , operation…
s6520643
  • 107
  • 1
  • 8
2
votes
1 answer

Rendering a CSV sends a file (as if I used send_data) instead of rendering a text

The following code returns me a people.csv file instead of rendering a text. If I am not using respond_to block and simply render a text, the browser works as expected. What forces the browser to send data in a file? The mime-type is 'text/csv', as…
Alexei Danchenkov
  • 2,011
  • 5
  • 34
  • 49
2
votes
1 answer

How do you spec an overridden Rails 3 FormHelper?

I have overridden the standard Rails FormHelper to get it to spit form elements out in our (pretty much Bootstrap-based) format (after http://www.likeawritingdesk.com/posts/very-custom-form-builders-in-rails). It works fine, but it is difficult to…
2
votes
1 answer

ActionView::Template::Error (highcharts.js isn't precompiled):

my app on heroku shows this error: ActionView::Template::Error (highcharts.js isn't precompiled): I tried two solutions I found on internet config.assets.initialize_on_precompile = false and config.assets.compile = true I read a post (I don't…
Asantoya17
  • 4,465
  • 6
  • 23
  • 29
2
votes
1 answer

How to get number with precision in a controller in rails

See this question. An answer points out that you can include ActionView::Helpers::NumberHelper in order to get the number_with_precision method to work in your controllers. This is also described as a bad practice. I am working on exporting data…
John
  • 13,125
  • 14
  • 52
  • 73
2
votes
2 answers

MissingTemplate : Render partial in Rails 3.2.3

Hi I am new to Ruby on Rails and I am following Michael Hartl's book online. In Partials section of his book. The code he used to render partial was <%= render 'layouts/stylesheets' %> but I get this error. I read the API and tried this <%=render…
markphd
  • 1,394
  • 1
  • 12
  • 17
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
2
votes
0 answers

'Called id for nil' when accessing collection elements in a view

I've got some really weird stuff happening. In a view, I'm populating a collection like this: <% foo_options = Bar.find(f.object.bar_id).supplier_contracts.collect(&:foo).uniq.compact : [] %> This is a collection of ActiveRecord models. EDIT: This…
HargrimmTheBleak
  • 2,147
  • 1
  • 19
  • 19
2
votes
2 answers

Launching a file using ACTION_VIEW Intent Action

I have the following code to launch a file : try { path = fileJsonObject.getString("filePath"); if (path.indexOf("/") == 0) { path = path.substring(1, path.length()); …
Smitha
  • 6,110
  • 24
  • 90
  • 161
1
vote
1 answer

Rendering ActionView without Rails for testing

How can I test my ActionView extensions (e.g. a new helper) without using full Rails stack? I use RSpec, so I have somehow to render a template from my /spec/views/ folder from spec_helper.rb. What is the best way to do that?
Ximik
  • 2,435
  • 3
  • 27
  • 53
1
vote
2 answers

Ruby on Rails links

I have an instance with a description: instance = Object.new instance.description = 'Google' Then in the view, I display it using = sanitize(instance.description) It displays the link correct but when I hover over the…
Cecille Manalang
  • 213
  • 3
  • 14
1
vote
1 answer

Ruby: how to ouput PDF object element?

I am embedding a pdf file in rails view using embed tag, i have write it in simple html and its working fine but i need to write this tag in rails conventions. The code is like:-