I have two models which are associated through has_and_belongs_to_many relationship. I have created a virtual attribute :full_name from the first mo ...
I have two models which are associated through has_and_belongs_to_many relationship. I have created a virtual attribute :full_name from the first mo ...
I have a method/function of a virtual attribute in Model1: How can I call this method in Model2 to get the same result? I was trying it this way bu ...
My AddressController: My model AddressSearch: View: I have an attribute called name in this dataProvider. I would like to create a new virtua ...
So in my Rails web application I have a section of code that prompts underage users to input a parent/guardian email when creating an account. In my d ...
I'm trying to calculate and display a date using a virtual attribute in Rails. I have a model, Group, and each Group has several GroupMeetings. There ...
I'm going through Michael Hartl's rails tutorial and have come to a point where he defines a virtual attribute, remember_token and later assigns a val ...
I'm new to OOP and Yii2. I have a function in Model: in the View until now I have used it like this: and it would return the correct value. Now ...
I am trying to use predefined constant in Model virtual attributes. when I create user, it shows absolute avatar_url and works fine. Problem: when ...
Model: ModelSearch: now if I add fnGdiff to gridview, there is always a number(?!) by default in the textfield where we can do filtering. It is ...
I have normal ModelSearch with ActiveDataProvider, and I would like to add a virtual/related attribute to sorting in gridview. If I'm doing with setSo ...
let's say I have a model like this: Where @surface.area returns the area of a surface. Now, lets say I have many surfaces called @surfaces and I wa ...
I have a class Group, which hasMany Teams and I would like to order them by their score. A team's score is calculated by iterating through its games, ...
I've defined a virtual attribute: I've noticed that it is not populated during massive assignment (after submitting the form, in $model->load($_ ...
Context: I have a company model with many projects, having many tasks. The company also has many employees, which in turn have many tasks. Schema: ...
I'm making a Rails 4 application. Each incident belongs to a user. Each incident has many events. I want that I can create an Incident with current_us ...
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 c ...
You'll see in my code I've got a "has_many => belongs_to" models association and a nested form in the new actions's view. Plus, I've used Using tw ...
I have a Blog model of which content will be stored in a file and the remaining things will be stored in the table. My solution for this is as below ...
I have a model of product and I need to write in the _form view , the number of the product that an admin wants to insert. I have another table with t ...
I have a Node model, that has a virtual attribute user_tags. This is what it looks like at the console: What I would like to do, is create a scope ...