virtual-attribute Questions

3

Solved

I'm having a problem in my Rails 3.2 app where a virtual attribute sent restfully via JSON is not in the right place in the params hash. Well, it isn't where I expect. It remains to be seen if my e...
Attested asked 19/2, 2012 at 22:54

1

Solved

I've defined a virtual attribute: class ContactForm extends Model { public $name; // is not a DB field I've noticed that it is not populated during massive assignment (after submitting the for...
Shaver asked 21/2, 2016 at 23:30

4

Solved

I have a dropDownList in my view, it is populating from clients table, the table contains columns like first_name, last_name,id etc., Now I want to show the first_name and last_name as display text...
Pangaro asked 10/10, 2012 at 4:41

3

Solved

I know that I can write attr_accessor :tag_list to make a virtual attribute tag_list for an object in Rails. This allows there to be a tag_list attribute in forms for the object. If I use attr_acc...

1

Solved

So I have a class TimeBank, and its being updated, and is getting two new virtual attributes which will manipulate two other existing attributes (DB columns). class TimeBank < ActiveRecord::Bas...

3

Solved

Hi I'm trying to setup a validation that is only called in a specific form view, to do this I'm trying to create a hidden_field for a virtual attribute on the form and set this to a value, then val...

1

How can I use virtual attributes(getter, setter) in rails 4, as 'attr_accessible' removed. I am getting issue, here def tags_list @tags = self.tags.collect(&:name).join(', ') end I can ...

1

Solved

I have a basic nested form. I want to access a virtual attribute for the nested form's model. Model 1: Lease Has_many :transactions accepts_nested_attributes_for :transactions, :reject_if => ...
Kristakristal asked 4/3, 2013 at 19:21

2

I'm looking for a rails-y way to approach the following: Two datetime attributes in an Event model: start_at: datetime end_at: datetime I would like to use 3 fields for accessing them in a form...

3

Solved

In my application, I have a Widget model, a Feature model with a has_many through association by WidgetFeature table. As per the requirements, when I am sending a WidgetFeature object, I should a...

1

I am trying to implement a simple tagging system using a tag virtual attribute on a notes object. a tag contains a label and a user_id. what I would like to do is update the HABTM to relationship t...
Discordant asked 20/1, 2011 at 0:40

2

Solved

I have a user model with attributes 'first' and 'last' So for example User.first.first #=> "Charlie" User.first.last #=> "Brown" This User model also has a virtual attribu...
1

© 2022 - 2024 — McMap. All rights reserved.