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

Chaining template handlers in Rails 3

Somehow I was under the impression that naming views like this was possible: show.js.custom.coffee Suppose I have both handlers working properly, and both show.js.custom and show.js.coffee work fine, but when I put both extensions together, Rails…
Ivan
  • 97,549
  • 17
  • 50
  • 58
1
vote
0 answers

Rails: render complex view in parallel

I have a view similar to this:

Example restaurant

<% @restaurant.menus.each do |menu| %> Here a long menu is generated (expensive operation) <% end %> I already use fragment caching for speeding up the next requests. However when the…
collimarco
  • 34,231
  • 36
  • 108
  • 142
1
vote
2 answers

helper with block and raw

Given an helper like this one def helper_method(name, &block) result = block_given? ? capture(&block) ... result end And this HAML view = raw helper_method do .content some html content result is nil when used with raw. why? I know how…
Charles Barbier
  • 835
  • 6
  • 15
1
vote
1 answer

Replace example.org when generating url in Rails

Step to reproduce: rails new testurl cd testurl Add resources :tests, only: [:index] in config/routes.rb Create a new file in app/views/test/test.html.erb with content of <%= tests_url %>. What I need to do is render this view as HTML string, to…
dcangulo
  • 1,888
  • 1
  • 16
  • 48
1
vote
2 answers

Show ActionSheet in Popover- what am i doing wrong?

Sams **Teach Yourself iPad Application development in 24 hour's says I can "display an action sheet in a "nonanimated" fashion, filling a full popover view when it first appears...To do this, you need to show the action sheet with the method…
PapillonUK
  • 642
  • 8
  • 20
1
vote
1 answer

Rails server works in dev mode but not in production mode

I have been building an app for a few months now, I had it hosted on heroku, and I started making changes to it for a while without pushing to heroku, just working on localhost. I went to push it to heroku and ran into an issue with the asset…
sethb
  • 44
  • 2
  • 5
1
vote
2 answers

Access compute_asset_host from inside a rake task?

I've tried including ActionView::Helpers::AssetTagHelper and a bunch of variants of that, but I always get an error saying NameError: undefined local variable or methodconfig' for main:Object` Updated with more info I need to be able to reference a…
Chris Bloom
  • 3,526
  • 1
  • 33
  • 47
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

Field error proc with field name in error rails

I am trying to add field errors in rails with field_error_proc. But I could not find a way to add the error with the field name. Below is the code that I am using to generate a field with errors in rails. ActionView::Base.field_error_proc = proc do…
Aarthi
  • 1,451
  • 15
  • 39
1
vote
1 answer

Rails 6: undefined method `with_indifferent_access' for "{}":String

I am having a problem when I deploy my project to Heroku. Running it in my localhost works fine and I but deployed gives me this error: I am using the public_activity gem to get a feed of the last activity done in my…
Borja Soler
  • 57
  • 1
  • 7
1
vote
1 answer

<%= with a block in rails 4

I'm trying to use a block in a helper, but that's giving me this error: SyntaxError - syntax error, unexpected ')' ...rbout.concat(( green_title do ).to_s); _erbout.concat "\n ... ... ^ (erb):4254: syntax error,…
Don Giulio
  • 2,946
  • 3
  • 43
  • 82
1
vote
4 answers

Rails 3 destroy link not working

My destroy link is not working. My index view:
<%= render 'konkurrencer', :remote => true %>
<%= debug(params) %> My konkurrencer partial: <% for konkurrancer in @konkurrancers %> <%= link_to 'Destroy', [:admin,…
Rails beginner
  • 14,321
  • 35
  • 137
  • 257
1
vote
1 answer

Could you explain this syntax that I found in a tutorial? <%= link_to 'Show Previous', '?m=all' %>

I was following a tutorial, and found the following which is now in my app/views/message/index.html.erb <%= link_to 'Show Previous', '?m=all' %> I've never seen the '?m=all' part before, and am trying to understand how it works. The relevant…
user11703419
1
vote
2 answers

Where rails view finds these methods?

Iam working with Rails from nearly 1 year and as a learner the most difficult matter to me is the view stuff. I have view file that embeds this: <%= index %>. I tried to find where this method is defined in the code. I searched and found 12…
Hairi
  • 3,318
  • 2
  • 29
  • 68
1
vote
1 answer

Rails partial's local variable doesn't get set

I'm confused with passing a controller's instance variable to a partial template (named after this instance variable). Documentation from http://api.rubyonrails.org/classes/ActionView/Partials.html says: By default PartialRenderer uses the template…
jdoe
  • 31
  • 3