Questions tagged as 'ruby-on-rails'

1
answer

Rails 4 Error each_with_index when using activerecord-import

I'm trying to import an app into Rails 4, using the gem activerecord-import . When I try to run the command: Detail.import( columns, values, :validate => false ,:timestamps => false ) I get an error like this: **NoMethodEr...
asked by 01.06.2016 / 18:10
1
answer

Nested Attributes Rails child model not saved

Good afternoon! I'm having a problem storing templates with nested attributes . In the app we have Customer , which has 1..n Contacts , which in turn has 1..n Telephones . I researched a lot before putting it here and decided to onl...
asked by 30.03.2016 / 20:10
1
answer

How do I make many-to-many relationship in Ruby on Rails with has and belongs to many?

I have a system table and a table category, a system has many categories and a category has several systems, I wanted to use the has_and_belongs_to_many option of Rails (for being a simple interface and even to learn how to use this feature). Bu...
asked by 26.09.2016 / 15:58
1
answer

Tests with rspec - problems with stub and should

Hello. I am new to testing and I have two tests with problems, one of helper and one of model, being: 1) TodosHelper TodosHelper#visibility(todo) when todo is public Failure/Error: before { helper.stub :current_user => current_user } No...
asked by 10.06.2016 / 05:44
1
answer

Mysql, access denied for user, using password: no

When creating a new project in rails using mysql rails new exemplo -d mysql and then rake db:create I have the following error Acess denied for user 'root@localhost' (using password: NO) Please provide root password for your MySQL in...
asked by 26.07.2016 / 17:27
1
answer

Entity Architecture in Rails

I'm in doubt about what would be the best way to represent a client name entity that may have sub-layers of the same entity. Customer may own another Customer who is actually a carrier, and that Transporter may have another Customer who is a...
asked by 06.01.2016 / 14:37
1
answer

Could not find gem byebug (= 0) in Ruby on Rails

When I run the command rails server , the following message appears:    Could not find gem byebug (> = 0) This is in Windows. I tried to use gem install byebug but it does not work and in Linux it has the following message...
asked by 21.11.2015 / 12:11
1
answer

Run Rails commands on the Ubuntu terminal

I'm learning Ruby through an Alura course and I have a question.    bash: / usr / local / bin / rails: /usr/bin/ruby2.3: Invalid interpreter:   File or directory not found To solve this, every time the terminal is opened I execut...
asked by 16.06.2016 / 19:16
1
answer

Routes in ruby on rails

I have the following routes: resources :roles do resources :role_permissions do patch 'toggle_action/:id' => 'role_permissions#toggle_action' end end I create a link as follows: role_role_permissions_path(@role, @role_permissio...
asked by 16.04.2015 / 14:08
1
answer

Query using "select" and "joins" with activerecord in Rails 4

I need to make a report and I have the following query : Deducao.joins(:prestador) .select('pessoas.razao_social, pessoas.qtd_min_mensal, count(deducoes.id)') .group('deducoes.prestador_id') .having('count(ded...
asked by 01.07.2015 / 20:52