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
0 answers

How to write a view helper that renders works with HAML and ERB?

Hi I am working on a gem that defines a few view helpers and it heavily relies on concat and capture methods but I've recently discovered it doesn't work with HAML (haven't tested thoroughly, but so far doesn't render concat(nated) stuff). I read…
Macario
  • 2,214
  • 2
  • 22
  • 40
2
votes
2 answers

Rails 4 render partial with locals

I have a partial _errors.html.hamlto display the form errors in my application. The code inside the partial: .errors %ul - errors.full_messages.each do |message| %li= message I am rendering the partial from projects/new.html.haml as =…
Arun Kumar Mohan
  • 11,517
  • 3
  • 23
  • 44
2
votes
3 answers

Why does this if statement in my application.html.erb not work like I expect?

In my application.html.erb, I have the following: <% if (controller_name == "questions" && action_name == "index") || (controller_name == "jobs" && action_name = "index") %> <%= "This is the IF for #{controller_name} and…
marcamillion
  • 32,933
  • 55
  • 189
  • 380
2
votes
1 answer

What is the most Rails'ish way of handling multiple layouts/views for the same controller action?

The scenario is this: I have some users on my site. A user has a role, the relevant ones here is admin and normal. I also have a model, let's call it SomeModel. I have created a backend for the site, which uses an admin layout. All admins have full…
rhardih
  • 863
  • 1
  • 10
  • 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
2 answers

Force android app to open when it's installation complete

I'm running an android app to be the only app to run on the system, so, when boot-completed I launch the app and prevent the user from exiting it for any reason(which made me disable both navigation status bars). Then, to achieve an update to the…
Muhammed Refaat
  • 8,914
  • 14
  • 83
  • 118
2
votes
1 answer

An alternative to useing datetime_select in Rails

I'm not such a fan of using datetime_select. I think it renders ugly and isn't easy to deal with on post back. How do most people deal with it? Wouldn't it be easier to use a plain textbox and use javascript to validate the input as a date? I will…
CountCet
  • 4,545
  • 7
  • 30
  • 39
2
votes
3 answers

Rails 4.2: Unknown Attribute or Server Error in Log

I have a form with a select_tag and options_from_collection_for_select that I can't seem to get to pass. In the view, when the upload id is set to uploadzip_id I get a 302 redirect and when it's set to uploadzip_ids, I get a Unknown Attribute error.…
shroy
  • 918
  • 2
  • 10
  • 24
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
0 answers

how to access helper when building ActionView manually and not from a Rails Controller

I have a class (not a controller) that generates external javascript that we then store in redis and am using Rails 3.2.19. One of the views calls a helper that is located in application_helper but it is now erroring out saying that it can't find…
timpone
  • 19,235
  • 36
  • 121
  • 211
2
votes
1 answer

fields_for alter the record name

I am struggling with figuring out how to change the record on the fly. I want to the input field to change from people[name to people[][name] <%= f.fields_for :people, nil, prefix: "people[]" do |fy| %> <% 4.times.each do %>
Ikenna
  • 989
  • 4
  • 12
  • 24
2
votes
1 answer

Rails conventional render partial with objects within a namespace

I would like to locate a partial in the app/views dir to be shared by two name spaces. How can I link the missing partials, (lostees or others)/trees/tree.html.haml to trees/tree.html.haml using Rails convention shown in the islands/show.html.haml…
awilkening
  • 1,062
  • 8
  • 26
2
votes
2 answers

Avoiding repetitive "content_for" in views

I have a submenu placed in my layout wich differs from controller to controller, but not between each controllers method views. What I am currently doing is the following: <% content_for( :submenu ) do %> <%= render :partial =>…
Felix Andersen
  • 1,381
  • 2
  • 14
  • 26
2
votes
3 answers

content_for are not rendering in partial views

I have a rails app which uses a layout The simplified version looks like this: <%= render 'layouts/head' # renders the "layouts/_head.html.erb" partial correctly # the most head (css/js) content…
Jan
  • 12,992
  • 9
  • 53
  • 89
2
votes
1 answer

Cannot Add an ActionView to the Actionbar using ActionBarCompat from Holoeverywhere

I have updated holoeverywhere version in my project so I not longer use ActionBarSherlock (ABS) but ActionBarCompact (ABC) The problem I have is when using MenuItemCompat.getActionView(aMenuItem) I always get a null value. The exact code I have…