Questions tagged as 'ruby-on-rails'

1
answer

History of edits of a Ruby on rails template

I would like to know how I can create a history with all edits made to a template, in ruby on rails.     
asked by 25.08.2014 / 20:02
1
answer

How to include Bootstrap source files (Glyphicons) in Rails?

In my Rails applications I usually include Bootstrap manually in folders: app/assets/stylesheets/lib (CSS) and app/assets/javascripts/lib (Javascript) Everything works perfectly except for Glyphicons . I put the fo...
asked by 19.05.2014 / 14:24
2
answers

Validation in the model when doing update_attributes in Rails

I want to know how I would do a validation in my model for when the @ model.update_attributes (params) in my controller is called to return a possible error or false which seems to be the default returned by update_attributes. Following the l...
asked by 28.03.2014 / 21:26
1
answer

Ruby on Rails - undefined method 'errors' for nil: NilClass

I've been trying to insert the alert into a form but I get the following error: undefined method 'errors' for nil:NilClass In my form I make a reference to the error: <%= form_for :exercice do |f|%> <%= render 'erro' %&g...
asked by 13.04.2014 / 21:43
1
answer

Ruby on rails does not write to the database

Good evening, guys! I created a small form with two fields and in the future I intend to expand this form with one or two fields. It happens that the insertion of the data in sqlite is not being done, but it does not give any error. The ap...
asked by 02.08.2014 / 01:21
2
answers

Order by over a Count in another table

I wanted to sort a table of items by counting the positive (other table) ratings for that item. This query will be run in controler : item: index Item: id nome Avaliacao id item_id avaliacao[0 negativo, 1 positivo] For example:...
asked by 09.05.2014 / 03:49
1
answer

Devise with parent user and child user

I have this in my Class User in devise class User belongs_to :parent, :class_name => 'User' has_many :children, :class_name => 'User' ... end What I would like to know is what would be migration of...
asked by 06.05.2014 / 17:12
2
answers

How to create a template from another template?

I have two models. One called User and another called Professional, where: #user.rb class User < ActiveRecord::Base has_one :professional accepts_nested_attributes_for :professional end and #professional.rb class Professional < Acti...
asked by 05.01.2015 / 18:58
2
answers

Rails - check for non-matching records

I have a Rails application and I'm creating a notification system, the problem is that I do not know how to query for notifications not seen by a user in a practical way. The schema of the notification table is as follows: create_table "not...
asked by 18.06.2018 / 20:41
1
answer

Undefined method '+' for nil: NilClass - Ruby error

I have the following Ruby codes in three different files. Follow them: programa.rb require_relative "product" require_relative "store" cd = Product.new("CD",20.5) pinico = Product.new("Pinico",30.6) store = [cd,pinico] test = Store.new(...
asked by 03.04.2018 / 14:15