Questions tagged as 'ruby'

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

Upgrading a site to a newer version of Rails

How do you upgrade a site developed in Ruby on Rails to a newer version of Rails? For example from 4.2.4 for a possible Rails 5.0.0. I am still a beginner in the language and framework and I was left with this doubt if for example I develo...
asked by 25.09.2015 / 15:17
1
answer

Rails 4 + -jquery-datatable + ajax-datatable - Error 406 Http and ActionController :: UnknownFormat format json

I was studying rails and following the link tutorial. The steps in the tutorial were as follows, create a datatable that would make a request via json, the controller that would respond with the data and the data table would be populated....
asked by 15.09.2015 / 01:12
1
answer

Make condition inside the render

I'm learning Ruby and am having a question about how to make a if inside the render to display param only if it exists ... Ex: if params[:field] puts 'field' => params[:field], end How do I resolve this in this code?...
asked by 19.05.2015 / 23:01
1
answer

Database configuration using rspec-rails

In my spec / rails_helper.rb I added the following code so that the database was automatically created when running rspec : def database_exists? ActiveRecord::Base.connection rescue ActiveRecord::NoDatabaseError ? false : true end unless...
asked by 24.04.2015 / 21:00
1
answer

Why this form of using case does not work?

I have the following code: def label_file_type(type) label = case type.to_s when ['.jpg', '.jpeg', '.png'].include?(type) then content_tag(:span, 'Imagem', class: ['label', 'picture']) when ['.mp3'].include?(type) then...
asked by 20.04.2015 / 17:14
1
answer

Composite index - M: N in Ruby on Rails

I need to add a double index to the N to N ratio of the courses_internships table. it would look something like this: add_index[:course_id, :internship_id] . However, when I created the link table, the index was separated by the...
asked by 20.05.2015 / 18:14
2
answers

Require files no seeds.rb

I need to organize my seeds.rb file, so I created a namespace where I will add my classes ex: module Seeds class Apple def self.run puts 'teste' end end end Seeds::Apple.run This works perfectly, but I need to separate my class...
asked by 08.04.2015 / 18:43
1
answer

Hash within another hash always returns empty if a key is not used

I've created a method to group all the commits of a user per month into a hash: def calculate_month_ranking(commits) rank = Hash.new(Hash.new(0)) commits.each do |commit_yml| commit = YAML.load commit_yml.data commit[:commits].e...
asked by 02.06.2015 / 15:16
1
answer

Devise - Confirmation email and Forget password? [email does not send]

Problem does not send Confirmation Email and Password Change Problem After requesting the submission of forget password? it will load until giving time out . Thecreationofthetokenforpasswordexchangeisgeneratedcorrectly,acce...
asked by 25.03.2015 / 18:40