1
vote
0answers
18 views

Hybrid Model/Controller Validation?

I am looking to have a user enter in a URL to an image on a form. I already have this built. I would like for two different things to happen, but I was wondering if I could somehow combine them. When ...
0
votes
2answers
37 views

Rails nested form on HABTM: how to prevent dublicates?

I have simple app with 3 tables in DB and 'many-to-many' relationships. # Model Employee class Employee < ActiveRecord::Base has_and_belongs_to_many :phonenumbers ...
0
votes
1answer
18 views

How to tell if there was a save or validation attempt in a Rails model?

I need to check if a model has had any attempt to be saved or validated without actually saving/validating it. The method #valid? does run the validations, so it doesn't fit here.
1
vote
2answers
24 views

Rails custom attribute validation not allowing creation of new object

I have an answer model which belongs to a question which has a "correct" boolean column. Ideally a question can have only 1 correct answer ( much like the stackoverflow system). I have the following ...
0
votes
0answers
30 views

Rails: Custom Model Validation

Hi I am trying to write a custom validation for a model that does not allow the model to be saved if it fails the validation. Here is what I have so far: validate :valid_est_time private def ...
0
votes
1answer
39 views

Model validation, validate a string is an integer

Hi I have a model called users, and they have a cell phone attribute that must be entered as a 12 digit string leading with "+". I want to validate that the attribute they entered from a form is in ...
0
votes
1answer
21 views

Can't get this inclusion validation in rails working

I'm trying to make a test for gender in a model using Rspec - it looks like this: it "should require a valid gender" do wrong_gender_student = ...
1
vote
1answer
18 views

Validations using simple_form: validated object lost after hitting create

We have a form created by several controllers's new actions, which we reuse via render :new in the create action to display validation error messages. I believe this is the way to go for simple_form ...
0
votes
2answers
17 views

Is it possible to make an attachment optional in paperclip?

Here's how I am using paperclip in my model: has_attached_file :photo, styles: { display: { geometry: "146x153#", format: :jpg, }, message: { geometry: "48x48#", ...
0
votes
0answers
19 views

Rails validates :length issue

I have a text box where I would like to set a maximum character count of 1400. I am using a jQuery plugin to provide visual feedback of this character count. ...
0
votes
0answers
20 views

Validating Child Object with ActiveModel Validations

I have two plain Ruby classes, Account and Contact. I am using Simple Form's simple_form_for and simple_fields_for to create nested attributes. I am looking to fulfill the following validation ...
3
votes
3answers
82 views

Rails validation for has_one relation

I have two model like: class Employee field :name field :login, type: Boolean has_one :user end class User field :username field :email belongs_to :employee validates_presence_of ...
0
votes
1answer
25 views

List all validation rules for a certain model

I think I have duplication in validation of an attribute since I am getting the same validation error twice on email field. I suspect the some gems may enforce the same validations. Is there a way ...
0
votes
1answer
48 views

Active Record Error messages form_tag Rails 3

I have a validation in my model like so class Prediction < ActiveRecord::Base attr_accessible :home_team, :away_team, :home_score, :away_score, :fixture_date, :fixture_id, :user_id has_one ...
0
votes
1answer
60 views

Check if record exists in Model Rails

I was wondering if i would need to create a custom validation for the following scenario. I have a Prediction model, in which a user submits their predicted scores for a set of football matches, they ...

1 2 3 4 5 39
15 30 50 per page