Questions tagged as 'ruby-on-rails'

3
answers

Correct test for model (RSpec)

I created a test to validate my model and want to know if it is correct. describe Article do it "object article create is valid?" do article = Article.create article.title = "Title for Test" article.description = ""...
asked by 30.01.2014 / 14:50
1
answer

Doubt about using send () in ruby

The general idea of OO is that each object can react differently to the same message. In ruby, I noticed that it is possible to use the send () method and that every object in Ruby has this method. So, I can do something like: object.send (:...
asked by 11.10.2015 / 22:20
4
answers

Mask in Rails fields

I'm getting a theoretically simple thing, I'm looking for a date mask on my application.js : //= require maskedinput jQuery(function($){ $("‪#‎datadoacao‬").mask("99/99/9999"); }); In my partial form: <%= f.text_field :data_doaca...
asked by 27.07.2016 / 05:32
2
answers

Rails Console does not load the methods and classes of my application, why?

I have a model named Person, when I open the Rails Console and try to assign it to any variable, I get this: user.localapp (test) $ rails c Loading development environment (Rails 4.2.0) (Ruby 2.2.0) localapp> a = person.first NameError: und...
asked by 12.05.2015 / 19:04
2
answers

Extra fields do not save with Devise

I'm new to rails and I'm trying to implement Devise with some extra fields. It is saving the email and password correctly, but my first_name and last_name fields are not being saved. It is nil This is my view of the regis...
asked by 04.06.2014 / 02:17
1
answer

How do I force a nested route to use the same parameter name as the parent route?

My route schema needs to add 3 new routes to custom actions in my controller: start , cancel and finish . resources :disputes do scope module: :dispute, except: :index do resources :conference, shallow: true, shallow_prefix: :dispute...
asked by 03.01.2017 / 21:25
3
answers

Display related data during Iteration

I have created a relationship between the client and content models and I can access their data using console normally. con = Content.find(1) con.client.name # Nome do cliente But when I try to access this data during a...
asked by 28.09.2016 / 20:17
1
answer

Find random objects using conditions

I want to search for example 10 random people of the same party I did the following, but this is selecting people from all parties, what can be done? = D class Pessoa < ActiveRecord::Base class << self def filtra_pessoas(...
asked by 28.09.2016 / 07:17
1
answer

What does a join table mean?

I was reading the book Beginning Rails 4, when I came across messe excerpt on page 100.    Let's get back to the relationship between users and comments. You need to tell your user that you have many comments through its articles. Basically,...
asked by 04.09.2014 / 14:09
2
answers

Initializing Redmine

I have a small problem initializing my Redmine in the environment. After all the configuration of Mysql etc ... when I use the command to start the application I get the message: ArgumentError (A secret is required to generate an integrity has...
asked by 16.03.2014 / 03:53