Questions tagged as 'ruby-on-rails'

1
answer

Remote: true error using in RAILS, for POST of a JS file

I have a problem with my code, I want Rails to remote: true from "Login" with a class and an id as below, but the server passes a GET, but I want it to look in the controller format.js to send a POST type JS function, I need to know if the code...
asked by 11.11.2016 / 22:23
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
1
answer

How do you consume custom routes with ember?

My api rails has the route users / me that returns the data of the current user, it is written like this: #routes resources :usuarios do get :mim, on: :collection end #controller def mim render json: usuario_atual end H...
asked by 03.11.2016 / 22:04
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
1
answer

Saving parent and child if both are valid in Rails

I have two classes Protocolo and Movimentacoes , in saving Protocolo I create a new Movimentação . class Protocolo < ActiveRecord::Base has_many :movimentacoes after_create :movimentacao_inicial def moviment...
asked by 05.08.2016 / 21:17
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

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

Bundler error :: GemRequireError

When I try to launch the rails server, does anyone know how to proceed? Erro (Bundler::GemRequireError /home/gabriel/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in 'rescue in block (2 levels) in require': There wa...
asked by 04.04.2016 / 18:32
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