Questions tagged as 'ruby-on-rails'

1
answer

I18n translate enum

I have an enum in my model containing the states, and I created a translation for it with I18n but it gives the following error:    translation data {...} can not be used with: count = > 1 My enum: unless instance_methods.include? :u...
asked by 09.04.2015 / 19:58
1
answer

Problem generating a Ruby on Rails app

When trying to create a Ruby On Rails application, this happened; I tried to skirt this way; How to solve this?     
asked by 23.02.2015 / 12:48
1
answer

How to create block helpers in Rails?

I need to create a dropdown menu helper ... But I have no idea how to do this. I wanted a helper in block form, as it is done with forms. Ex.: <%= form_for(@teste) do |f| %> <%= f.text_field :um_campo %> <% end %> In m...
asked by 16.12.2014 / 21:45
2
answers

i18 - How to translate attributes in error messages

Friends I have something like this: user.rb: class User < ActiveRecord::Base has_one :address, autosave: true, dependent: :destroy accepts_nested_attributes_for(:address, update_only: true, allow_destroy:true) end address.r...
asked by 27.12.2014 / 05:36
1
answer

After changing the name of a field in a table, how do I update the entire Rails project?

I used Scaffold to generate a small project, then I changed the name of a field in a table, (something that is rare but happens in real life), how to update the entire project? P.S .: The rake db: migrate has already been done without error and...
asked by 07.12.2014 / 14:05
1
answer

Using Jekyll creating a news feed

I have the following question how do I create a news feed? Do I have to add something inside the config.yml file? Inside the _post folder I have the file 2015-03-03-welcome-jekyll.markdown --- layout: post title: "Welcome to Jekyll!" date:...
asked by 06.03.2015 / 17:12
1
answer

Using strong attributes with rails 4 and has_one relationship

I have a has_one relationship similar to yours where a :person has a :address . It turns out that the relationship is generated but the street that I put in input :street (address attribute) is not saved. I already...
asked by 20.01.2015 / 11:56
1
answer

How to handle the requirement for certain attributes in models that include a concern in Rails?

I'm working on a project where I have several models that share the behavior of being approvables . After a little research, I came to the conclusion that the best in this case is to use the concerns pattern with the help of ActiveSupport ::...
asked by 23.11.2014 / 02:02
2
answers

Rails 4 translated error messages, change model name and attributes

Hello, I'm starting in rails and I'm getting to handle the error messages in pt-BR. I'm using MongoDB / Mongoid for the database layer. I have a user model, with attributes name , email and password I downloaded the gem 'rails-i18n',...
asked by 11.02.2015 / 03:06
1
answer

Simple_form disabling selection item according to registration status

I have f.association that brings all registered clients. On the client I have a status field. I would like that when the status is false , the client appears in the select box, but it is not selectable, is this possible?...
asked by 06.10.2014 / 18:10