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

Rails link_to to generate URL with subdirectory

In my routes file I have the line: match 'documents/:category/:id' => 'documents#show' allowing me to use URLs like: *localhost:3000/documents/lesson_plans/day_01* The URL works correctly, but I can't figure out how to generate it using…
nslocum
  • 5,037
  • 1
  • 27
  • 27
1
vote
1 answer

Is it possible to stop Rails from rendering views for actions not defined in controllers?

Following this question, I'd like to know if there is a way to override that new rails behaviour. I run into a security issue with a forgotten view, that was suddenly exposed although the action was not defined in my Controller. I think it'd be…
dgilperez
  • 10,716
  • 8
  • 68
  • 96
1
vote
1 answer

Android - Open selected picture in Action view?

In my app i got a galleryview. All the pictures are thumpsnails, and i want to open the picture in some kind of action view when it's selected. But i can't seem to find out quite how. Can any one help? EDIT: My gallery is not loaded from the SD…
Kano
  • 1,433
  • 2
  • 12
  • 18
1
vote
2 answers

Receiving AbstractController::DoubleRenderError when using authenticate_or_request_with_http_basic()

I have a working controller action that breaks when I add a call to authenticate_or_request_with_http_basic at the beginning of the block. Here is the non-functioning action code: def index authenticate_or_request_with_http_basic do |username,…
1
vote
3 answers

Rails complex nested forms with 3 models

This question concerns three models: Sale class Sale < ActiveRecord::Base has_many :sale_items has_many :items, through :sale_items end Item class Item < ActiveRecord::Base has_many :sale_items has_many :sales, :through =>…
clem
  • 3,524
  • 3
  • 25
  • 41
1
vote
0 answers

kill an ActionView (Web browser) in the Android stack of my application

I need to call a ActionView in my application. But after used it, I would like to kill it of my stack (if I press return,I don't want to come back in this view). How can I do? Here how I call the actionView: Intent i = new Intent(Intent.ACTION_VIEW,…
user420574
  • 1,437
  • 5
  • 21
  • 33
1
vote
1 answer

Is it possible to just update Rails form input field value using turbo frames?

Let's say I have a form built with Rails form builder. It has a text field, and I want to dynamically update the input field's value using AJAX and turbo streams. Is it possible to update the same text field's value without replacing it with a newly…
1
vote
1 answer

Rails: undefined local variable or method `view_context' for #

I have a helper called FeaturesHelper that has data about some features: feature_info = [ {features: [ { description: "This is a #{view_context.link_to "link!", "https://www.example.com", target: :_blank,…
Sara Fuerst
  • 5,688
  • 8
  • 43
  • 86
1
vote
3 answers

Passing path to current_page method

I have a helper method to help to determine whether or not a navigation menu item should be active/inactive. def events_nav_link nav_item = 'Events' if current_page?(events_path) # additional conditions here # do nothing else …
keruilin
  • 16,782
  • 34
  • 108
  • 175
1
vote
0 answers

Issues rendering view with flash.now and form_with element

In a Rails 7 controller create action I want to render the :new action/view if the model.save action fails. My initial code looked like this; def create new_city = City.new(params.require(:city).permit(:name, :prefecture_id)) respond_to do…
1
vote
1 answer

testing a that Rails controller chooses a layout without rendering the layout

i'd like to stub out render and i'd like to test that a certain layout is chosen bonus catch: in the test env, that layout file will not exist is there a clever way to detect if the controller has selected a layout without rendering, and without…
whatbird
  • 1,552
  • 1
  • 14
  • 25
1
vote
2 answers

How do I connect a general search form (form_with helper) to a specific route and pass the input to the params hash?

I'm having trouble connecting a form_with helper to a specific action. I want to search through my posts and so have created a search action in the posts_controller. The logic is working (tested by typing in the request in the url manually) but I…
1
vote
0 answers

rails 3 ActionView::Template::Error (no block given (yield))

This code was working in rails 2.3.X...but it return this error in rails 3.0.9 ActionView::Template::Error (no block given (yield)): 7: <%= yield %> app/views/colones/_colone.html.erb:7:in…
4nkh
  • 11
  • 1
  • 5
1
vote
1 answer

Ruby on Rails path awareness

Lets consider the following situation. There is products_controller which can be accessed from "Admin" and "Configure" sections of the Ruby on Rails application. In the view I need to differentiate which section I am currently in (i.e. "Admin" or…
alexs333
  • 12,143
  • 11
  • 51
  • 89
1
vote
1 answer

Rails - content_tag for table cell with rowspan

How would you translate this into a Rails content_tag? glah
keruilin
  • 16,782
  • 34
  • 108
  • 175