Posts by Ben-Hur Batista • 261 points
7 posts
-
0
votes2
answers152
viewsA: Chartkick Problem in a Rails Application
In the model add the to_s method def to_s "#{self.name}" end
-
1
votes1
answer303
viewsA: How to make an ajax request that returns an html text?
do not need to use the js format, use html and leave the layout as false #exemplo format.html{ render '/products/new', layout: false } if request.xhr? ai when receiving the response from the server…
-
2
votes1
answer532
viewsA: How to render a partials structure from another directory in Rails?
You can put the entire file path, in case there is a partial inserted in app/views/users/_map.html.erb you can make the call like this <%= render 'users/map' %> and in case you need to specify…
-
1
votes1
answer108
viewsA: Nomethoderror in Usuario#new Rubyonrails
You need to add the route in config/Routes.Rb Sample::Application.routes.draw do #outras rotas... resource :usuario #adicione essa linha end and controller name always in plural ex.: User…
-
8
votes6
answers42802
viewsA: What is the difference between . on("click", Function() {}) and . click(Function() {})?
I would like to add one more detail, while ". click" is specific to an event the ". on" can delegate the same function to several events Ex.: $('selector').on('click mouseleave mouseenter ...',…
jqueryanswered Ben-Hur Batista 261 -
0
votes2
answers91
viewsA: Validation of has_and_belongs_to_many in Ruby on Rails
I don’t know if the correct approach would be Many to Many for this case, but since you are doing this you should have an intermediate table of this relationship, create a model of it ex.: class…
-
1
votes3
answers10288
viewsA: How to know which select option has been selected
Could include a value for each option as for example <select class="formacao"> <option value="1">Ensino fundamental incompleto</option> <option value="2">Ensino fundamental…