Questions tagged as 'ruby'

1
answer

Rails 4.2.6 authenticate error method

I'm trying to use the authenticate method and rails returns NoMethodError: undefined method 'authenticate' for #. My controller: class SessionsController < ApplicationController     #include SessionsHelper def login render 'admin/login'...
asked by 03.11.2016 / 01:01
1
answer

Update_All Rails with field of the database itself

I need to make a change in all the columns of the database by replicating information from another column, for example: Model.update_all("a = b") I would like to create threads and start spinning, for example at midnight, and finishing at...
asked by 03.11.2016 / 20:37
2
answers

List random objects

How could I generate random cars in the following model? would it be better to do this in the controller? class Pessoa < ActiveRecord::Base has_many :carros end     
asked by 26.09.2016 / 15:44
1
answer

Regular expression for zip file

How to add a zip file instead of an image? class UploadDatabase < ActiveRecord::Base has_attached_file :zip_file, styles: { medium: "300x300>", thumb: "100x100>" }, default_url: "/images/:style/missing.png" validat...
asked by 15.12.2016 / 18:24
2
answers

Rails and MySQL - Data Types

I recently started using Ruby on Rails for a project, and I have questions about scaffolding and other DB features in Rails. Here is a topic explaining data types in Active Record Migration link How can I use other types of data present...
asked by 19.07.2016 / 20:15
1
answer

How to disable a select associaition of the simple form

I have a select association of the simple form, the value of it passing through controler and I would like that in form the user did not have the option to select another value. I have tried to use disabled: true disabled: true, input_html: {dis...
asked by 07.07.2016 / 22:11
1
answer

Problem with nested form has_many through using dynamic form

I'm having the following problem on a form using has_many through. I have a registration where I created dynamic forms. These dynamic forms are inserted in another screen. I'm having difficulty in the controller where I insert these fomula...
asked by 22.06.2016 / 17:19
1
answer

Update stock before saving template with nested_attributes and gem cocoon

Friends, I have a form that uses nested_attributes and I use the cocoon gem. I have 3 models involved. Variation that contains the stock, Order, which contains the order and is the Detail parent that contains the order detail. The save is wor...
asked by 25.02.2016 / 17:24
1
answer

Nested objects has_one rails 4

Talk to people, I'm new to rails and I'm trying to make a crud with two objects, a Project and another Album. Project has_one Album, as test each only has one: name as parameter, but I can not create a Project with album. Here's my code: p...
asked by 22.01.2016 / 20:50
1
answer

rake aborted! Ruby on rails, Wordpress Plugin

I had to enter the world of Ruby the force to modify a plugin of Wordpress, I'm new to Ruby, I'm only followed by tips and I'm not able to solve the problem. Following the steps to do this I encounter this error after entering the following comm...
asked by 07.10.2015 / 22:29