Questions tagged as 'erb'

1
answer

How to render a partials structure from another directory in Rails?

1) Views structure Assuming I have two sets of views, set A and set B. Both sets are similar having the view index.html.erb and the partials _index.html.erb , _new.html.erb , _edit.html.erb , _table.html.erb...
asked by 21.10.2015 / 15:50
1
answer

error handling, rails 4

This error happens when the user does not select the option of the select field. The error up would be handled if it did not have the collect: NoMethodError in Subdisciplinas#create Showing _form.html.erb where line #18 raised: undefined meth...
asked by 26.10.2016 / 05:35
1
answer

Select sex with enum

I made the select gender field this way: model: enum sexo: [:feminino, :masculino, :desconhecido] def self.sexes_for_select sexos.keys.map{ |x| [x.humanize, x] } end form: <%= f.select :sexo, Pessoa.sexes_for_sele...
asked by 19.10.2016 / 17:32
0
answers

How to make a local variable an instance variable for an ERB template with binding?

Below I exemplify my need in a code where I need to redefine variables such as @dispute = dispute to be instance variables and the template loaded by ERB can access them through binding : class Remittance::ExportService def init...
asked by 02.02.2017 / 17:10
1
answer

Prompt property is not working

<div class="field col-xs-3"> <%= f.label :modelo_id %> <%= f.select :modelo_id, options_for_select( @modelos.collect { |modelo| [modelo.nome.titleize, modelo.id] }, @carr...
asked by 22.10.2016 / 19:39
2
answers

Problem rendering partials dynamically

I have the following code: <table class="table table-bordered table-striped" border="0"> <% @time_line.each do |time_line| %> <%= render partial: partial_name( get_type(time_line) ), locals: { register: time_line } %>...
asked by 21.05.2015 / 20:21
1
answer

syntax error, unexpected ',', expecting ')' - Rails 4

The Rails interpreter is sending me this message in the following line of code: ... <li> <%= form_tag("search", { method: "get", class: "navbar-form navbar-right", role: "search" }) do %> <div class="inner-addon right-addo...
asked by 03.08.2014 / 16:12
1
answer

verify if backend method is true and not client as well

I have a code that on my backend it returns true or false, I'm working with ruby and rails 5. So I have it's an if or so ja: <% if @order? %> <h2> teste 2 <h2> <%else> <h1>teste 1</h1> <%end>...
asked by 05.11.2015 / 18:06
1
answer

Help with Relationship between 3 Tables #Rail

I would like your help with this issue below I have 3 Tables: Product Purshase Supplier supplier_id product_id name class Purshase < ActiveRecord::Base belongs_to :product end class Product < ActiveR...
asked by 26.05.2017 / 20:27