Commit e5c7fb3bd6af87d63fbb532ab9dea808fa5dda90
Committed by
Rafael Manzo
1 parent
54bf07cf
Exists in
colab
and in
4 other branches
Create Reading
Signed-off by: Diego Araújo <diego.amc@gmail.com> Signed-off by: Renan Fichberg <rfichberg@gmail.com>
Showing
2 changed files
with
5 additions
and
2 deletions
Show diff stats
app/controllers/readings_controller.rb
| ... | ... | @@ -11,7 +11,7 @@ class ReadingsController < ApplicationController |
| 11 | 11 | |
| 12 | 12 | def create |
| 13 | 13 | @reading = Reading.new(reading_params) |
| 14 | - @reading.group_id = params[:reading_group_id] | |
| 14 | + @reading.group_id = params[:reading_group_id].to_i | |
| 15 | 15 | respond_to do |format| |
| 16 | 16 | create_and_redir(format) |
| 17 | 17 | end | ... | ... |
app/models/reading.rb
| 1 | 1 | class Reading < KalibroGem::Entities::Reading |
| 2 | 2 | include KalibroRecord |
| 3 | + | |
| 4 | + attr_accessor :label, :grade, :color | |
| 3 | 5 | |
| 4 | - validates :color, presence: true | |
| 5 | 6 | validates :label, presence: true, kalibro_uniqueness: true |
| 7 | + validates :grade, presence: true | |
| 8 | + validates :color, presence: true | |
| 6 | 9 | |
| 7 | 10 | end | ... | ... |