Questions tagged as 'ruby-on-rails'

0
answers

Read TXT / DAT file and parsing before saving to the database (mysql)

I have an application in Ruby on Rails whose function is to read a text file with the following "TXT / DAT" extensions, so I need a simple page (just an input field (file) and a button of submit) to send the file, the file itself has several lin...
asked by 17.05.2017 / 13:24
2
answers

Form with nested attribute and image upload

I have the following MODELS class Campaign < ApplicationRecord has_many :questions validates_presence_of :name accepts_nested_attributes_for :questions end class Question < ApplicationRecord belongs_to :campaign ha...
asked by 12.05.2017 / 19:46
1
answer

How to save data from another model. To archive information

I have two models: employees and reports. Each month some information about employees changes while others remain the same. I want to create reports with month-to-month information. So if you want to know how much an employee received in a given...
asked by 19.05.2017 / 20:50
1
answer

How to render a json with the json_api adapter using Rails Serializer?

Oops, I would like to render a json using the json_api ( link ) pattern using Rails Serializer ( link ). In my controler I'm rendering something similar to this: render json: {'user': {name: 'Peter' }} However, when I render this JSON, i...
asked by 11.05.2017 / 22:45
2
answers

Read TXT file in Rails

I have an application in Ruby on Rails and need to read a particular txt file that will be sent by the user. After sending the file, the data of the file will be displayed to the user so that it confirms if the file is correct, and if yes, t...
asked by 09.05.2017 / 13:51
0
answers

How to make a timer from a set date?

I've done a little system that logs the tasks. The user logs on and registers a title with a description and a date of type datetime in the database. In the system it can view your tasks, delete and edit. I would like to add a timer type that...
asked by 21.04.2017 / 00:52
1
answer

Rails 4 - Problems with has_many

I need help to display in the view the value in the view of a relationship with has_many. I have my product model: class Product < ActiveRecord::Base paginates_per 15 has_many :product_images, :dependent => :delete_all I'm doing a...
asked by 22.04.2017 / 00:34
1
answer

Devise - "Scoping" system tasks per user

I am making a simple application where the user can delete, edit, view and create tasks, the tasks have description, title and date that must be executed. I deployed devise to register users and login users, but I have difficulty "scoping" th...
asked by 08.04.2017 / 23:56
1
answer

Nested Wrong Translation Inflection

Opa, The problem is as follows: I have a Model Call Idea and I am trying to add a new nested in it to IdeaCategory which is an associative with Idea. Then we have: Idea: has_many: idea_categories, inverse_of:: idea, dependent:: destroy a...
asked by 09.04.2017 / 03:34
1
answer

devise get logged in user

I have a simple application using ruby on rails to gem rails admin and devise to authenticate I have a model called task where every task belongs to a user, so I would like to get the user who is logged in at the moment and assign it automati...
asked by 28.03.2017 / 15:33