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

How to call 'time_ago_in_words' from a FunctionalTest?

I'm using 'time_ago_in_words' function in a view, and I need to test the output in the FunctionalTest. But the test can not see 'time_ago_in_words' helper function. What should I do in order to use these helper methods from FunctionalTests?
Raiden
  • 173
  • 1
  • 6
16
votes
3 answers

How to open a file in Android via an Intent

how can I open a file that has been previously stored in the "privat" filesystem? The file is being downloaded by a webservice and should be stored on local fs. I got a "strange" error when trying to open the file via an Intent (Action_View).…
tim.kaufner
  • 1,247
  • 5
  • 13
  • 22
15
votes
2 answers

ActionView::MissingTemplate Error, Only When Visited By A Bot?

I have an action that serves my homepage. It works fine when visited normally (ie by a user in a web browser), but when visited by specific web crawlers, it throws the following error: A ActionView::MissingTemplate occurred in tags#promoted: …
Alex
  • 64,178
  • 48
  • 151
  • 180
14
votes
2 answers

What is the correct button_to syntax for adding a class to the generated form?

I'm trying to apply a class to the form generated by button_to in Rails 3. The :class option sets the class for the submit button so the docs tell us to use :form_class to apply a class to the form. E.g. <%= button_to 'x', user_contact_path(@user,…
digitalWestie
  • 2,647
  • 6
  • 28
  • 45
14
votes
3 answers

Rails3 ActionView Template Handlers doesn't work on Production Server

I am using Rails 3.2.3 / Ruby 1.9.3p125 / jbuilder (0.4.0) In my view/mycontroller folder i got a show.json.jbuilder file. when I test everything on my local machine with rails s -e production everything works fine. The JSON gets rendered as…
HaNdTriX
  • 28,732
  • 11
  • 78
  • 85
13
votes
3 answers

DEPRECATION WARNING: ActionView::Base instances should be constructed with a lookup context, assignments, and a controller

I migrate an application from rails 5.2 to rails 6. There is only have one thing left to do but I don't know how. I have this depreciation warning: DEPRECATION WARNING: ActionView::Base instances should be constructed with a lookup context,…
cercxtrova
  • 1,555
  • 13
  • 30
13
votes
1 answer

Rails problem with humanize

I am trying to humanize the symbols that are the keys for a hash c.each_key{ |f| humanize(f.to_s)} but for some reason, i get an error like so ActionView::Template::Error (undefined method 'humanize' for #<#:0xb5b6598>) any idea…
Amit
  • 3,952
  • 7
  • 46
  • 80
12
votes
3 answers

Rails 5.1 : url helper for files in public folder

In Rails 5.1, there is a deprecation warning if we use asset_path for files in public folder. DEPRECATION WARNING: The asset "favicon.ico" is not present in the asset pipeline.Falling back to an asset that may be in the public folder. This behavior…
Nicolas Maloeuvre
  • 3,069
  • 24
  • 42
12
votes
2 answers

Rails console - use image_tag method

How can I execute a image_tag method in a Rails console Run the console $ rails c Load helpers include ActionView::Helpers Execute the command image_tag('test.png') I got a strange error. Please help!
xpepermint
  • 35,055
  • 30
  • 109
  • 163
12
votes
9 answers

How do I implement Section-specific navigation in Ruby on Rails?

I have a Ruby/Rails app that has two or three main "sections". When a user visits that section, I wish to display some sub-navigation. All three sections use the same layout, so I can't "hard code" the navigation into the layout. I can think of a…
Matt Rogish
  • 24,435
  • 11
  • 76
  • 92
11
votes
2 answers

Upgraded Rails 4 to Rail 5- now getting "NoMethodError: undefined method `original_exception' for #"

As described, I updated my Rails from v4 to v5.1.5 by updating the version in the Gemfile and running rails app:update. I'm getting the following error that crashes my server whenever I try to load a page: ActionView::Template::Error ($map2:…
michjo
  • 407
  • 2
  • 17
11
votes
1 answer

Why do my self-referential templates break cache digest calculation in the console and rake but not in the server?

I have two partials which refer to one another. When I calculate nested dependencies in the console likes so (with some debug code outputting which template is being loaded): finder =…
John Bachir
  • 22,495
  • 29
  • 154
  • 227
11
votes
2 answers

When i try to create user rails says ActionController::InvalidAuthenticityToken

Updated: Problem solved I just had to put protect_from_forgery in the Users controller. Thanks to all. Rails 4.0.2 When I try to create a new record in the users table i get this message in browser: ActionController::InvalidAuthenticityToken in…
ElCoyote
  • 311
  • 2
  • 11
11
votes
1 answer

Rails form_tag form writing - with non-active record model

I'm somewhat of a Rails newbie. I'm writing a couchrest-rails app, so am not using activerecord for this model. I just figured out that that means that form_for(@model) won't work. I'm trying to work out how to use form_tag -- but most of the…
Pauli Price
  • 4,187
  • 3
  • 34
  • 62
10
votes
1 answer

Rails - ActionView::Base.field_error_proc moving up the DOM tree?

Is there anyway to go up the DOM tree from the html_tag element passed in? ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| # implementation end Is there anyway I can implement this method to move up the DOM tree and place a…
Andrew Hubbs
  • 9,338
  • 9
  • 48
  • 71
1
2
3
32 33