Questions tagged [dynamic-attributes]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
210 votes
5 answers
119k views

Rails find_or_create_by more than one attribute?

There is a handy dynamic attribute in active-record called find_or_create_by: Model.find_or_create_by_<attribute>(:<attribute> => "") But what if I need to find_or_create by more than ...
tybro0103's user avatar
  • 49.1k
18 votes
1 answer
8k views

getattr() versus __dict__ lookup, which is faster?

I can dynamically look up object attribute values using object.__dict__[some_key] or getattr(object, some_key). Which is faster or better, and why? >>> class SomeObject: ... pass ... >...
Cole's user avatar
  • 2,509
16 votes
4 answers
20k views

Dynamic attributes with Rails and Mongoid

I'm learning MongoDB through the Mongoid Ruby gem with Rails (Rails 3 beta 3), and I'm trying to come up with a way to create dynamic attributes on a model based on fields from another model, which I ...
joeellis's user avatar
  • 2,785
10 votes
3 answers
7k views

How to set a dynamic attribute

Is there a way to set col as dynamic or convert it in some way to a valid attribute? It is currently throwing the error: undefined method `col=' for #... def copy_stock_data_from_sandbox(cntrlr) ...
iamtoc's user avatar
  • 1,639
6 votes
2 answers
6k views

Using method missing in Rails

I have a model with several date attributes. I'd like to be able to set and get the values as strings. I over-rode one of the methods (bill_date) like so: def bill_date_human date = self....
tybro0103's user avatar
  • 49.1k
4 votes
4 answers
28k views

Remove image dynamically using jquery by clearing the src attribute

I know one can load image dynamically using $("#id").attr("src","path of the image"), but to onload the certain image on certain event, $("id").attr("src","") doesn't work. What's the correct way ...
Hazel's user avatar
  • 73
4 votes
1 answer
639 views

How to add conditional case sensitive attribute in Angular 2?

I want to add 'tourAnchor' attribute dynamically, for which I am adding below line. <div [attr.tourAnchor]=" feedbackIndex == 0 ? 'like' : null"> But, the attribute is being replaced to case ...
Rachitha B R's user avatar
3 votes
2 answers
6k views

How Do I make dynamic-attributes Work in JSP Tag Files?

So according to my JSP reference book, as well as every other reference I can find on the web, I'm supposed to be able to do something like: <%@ tag dynamic-attributes="dynamicAttributesVar" %> ...
machineghost's user avatar
  • 34.8k
2 votes
1 answer
4k views

Add attributes inside custom attribute in c#

I want to dynamically add attributes to properties of a given class, because the project will get bigger and the procedure is totally repeatinglly, something like so : public class MyAttr : Attribute ...
Hooman Limouee's user avatar
2 votes
2 answers
925 views

What is the purpose of dynamic fields in MongoDB? [closed]

At first, I thought it was pretty cool that you can add something to an object without it being defined in the model. But now I can't imagine how this is used in a web application like a Ruby on ...
Jake Smith's user avatar
  • 2,673
2 votes
1 answer
4k views

Unable to add a dynamic attribute to a Spring form:input tag

I have a Spring form tag and am trying to add a dynamic attribute (the "placeholder" attribute), but get the following error org.apache.jasper.JasperException: /WEB-INF/jsp/work.jsp (line: 290, ...
arnthorsnaer's user avatar
2 votes
0 answers
956 views

JSP Custom Tag File and Dynamic attributes

I have a custom JSP tag tag file, which is a wrapper around HTML input controls - dropdown etc, like so - <mytag:dropdown table="customer_master" style="display:block;" class="dblist"/> Here "...
Anupama's user avatar
  • 167
1 vote
1 answer
838 views

Can't inflate view with dynamic attr drawable

I have ExpandableListView with custom adapter and in groupview of this list I use dynamic attrs for it's imagebutton src drawable, declared in such style: g_view.xml ... android:src="?attr/img_add" ....
Movsar Bekaev's user avatar
1 vote
1 answer
2k views

injecting dynamic-attributes in a spring tag from a custom tag

I have a custom jsp tag that outputs a spring form input field (plus other layout elements). What I need to do is to be able to accept dynamic attributes and use them in the input field as-is. Eg of ...
Rasael's user avatar
  • 66
1 vote
1 answer
471 views

Dynamically creating read-only attributes

I'm currently trying to create a class that inherits from set, but allows calling for subsets with attributes. Since I want to create this class such that I can use it in any context, I want to have ...
JohnMcSwag's user avatar
1 vote
0 answers
620 views

VBA to html, onclick event function with dynamic element attributes

I am trying to automate filling in a web form on intracompany web in excel using IE. My previous question was to target dynamic element ID which got resolved thank to SIM (thanks again!) Unfortunately ...
Matus Kovac's user avatar
0 votes
2 answers
482 views

Ruby Best Practice - Dynamic Attributes vs Hash for RoR application

I'm developing a model which holds configuration settings for server options. The number and type of server options change, and I need some input on the pros/cons of two ways of doing it. I'm doing ...
Josh Johnson's user avatar
0 votes
1 answer
376 views

Python dynamic attribute value bind to method [duplicate]

after reading several posts here I am still a bit confused on the correct way to implement a Class dynamic attribute with a function as value. Been some time since I touched python and now I am a ...
Jimmy Kane's user avatar
  • 16.5k
0 votes
1 answer
727 views

Flexible Search dynamic attribute

I have a problem with Flexible Search, I have a dynamic attribute ("available parts") in the TimeSlotInstance entity, I would like to show the value of this dynamic attribute in the "...
John's user avatar
  • 15
0 votes
1 answer
231 views

How to pass an Event Listener as a Dynamic Attribute in Marko?

I'm trying to create a form in Marko and for the inputs I'm using a component that will create the inputs and will handle the validation. The hole problem is when I try to pass an event listener as a ...
user2611485's user avatar
0 votes
1 answer
56 views

Microsoft Bot Framework: How can I populate form flow field values based on the user's input for a previous field

I have the following attributes for a form flow case: public enum Offices{} [Describe("Country")] public string Country; [Prompt("Which office are you working in?{||}")] public Offices Office; I ...
Nour Rteil's user avatar
0 votes
1 answer
752 views

Testing dynamic attributes with cucumber, undefined method

We have a Style model with dynamic attributes, which can be saved by filling one field with the attribute key and the next field with the value. A typical params hash looks like this: {"utf8"=>"✓...
jugglinghobo's user avatar
0 votes
2 answers
356 views

How to design a system like google base with dynamic attributes? in Ruby on Rails

I am wanting to create an application that can allow users to add products for sale. I want to make it so that a user can add whatever type of product he/she likes and let them also create stored ...
user avatar
0 votes
1 answer
185 views

C# Dynamically determine class properties based on configuration for comparison

I have a configuration defined for duplicate check on each property in my model below public class ConfigurationModel { public GroupValue Value1 { get; set; } public GroupValue Value2 { get; ...
KeenUser's user avatar
  • 5,385
0 votes
0 answers
178 views

Dynamic attributes nesting within composite components

I am struggling with nesting dynamic JSF attributes within composite components. Let us imagine following structure on client side: class BackingBean{ Animal animal; } class Animal { Type ...
krzakov's user avatar
  • 4,021
0 votes
1 answer
669 views

Spring Error in dynamic attributes

I work with Eclipse Juno, Spring 3.2.6.RELEASE, Weblogic 10.3.6. I have the following jsp <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib prefix="form" uri="http:...
Carlota's user avatar
  • 1,237
0 votes
1 answer
113 views

attr_accessible for Rails 4 dynamic attributes

I'm using Rails 4 and want to define dynamic attributes, something like: (0..6).each do |i| attr_accessible "attr-#{i}" right now it's failling saying NoMethodError: undefined method `...
WhomWhomWhom's user avatar
0 votes
2 answers
1k views

Magento - Dynamic Product Attribute Only Pulling Data from Single CMS Block

I have set up 2 extra tabs on my individual product pages which should be pulling information from a different CMS Block for each product. However, when I view the product pages they are all pulling ...
Scott's user avatar
  • 3
0 votes
1 answer
362 views

How to make attribute_names list all attribute names in a document with dynamic attributes

I have a Rails 4.2 application with mongoid in which I'm importing csv files with test results. I can't define all fields in the model because they change from test to test and theres always around ...
Bart C's user avatar
  • 1,519
0 votes
1 answer
64 views

Rails / MongoDB: Variable to address object-attribute not translating

In my class AleShot I have some dynamic mongoid-attributes. In order to index them, I collect all attributes in an array called "dynamos". Now when I want to list these (see code below) I get: ...
CinemaCope's user avatar
0 votes
1 answer
273 views

Dynamic Attribute is stored first time but not followings in grails application with mongodb

I'm trying to add one dynamic attribute to my Domain Class and I'm experimenting an extrange issue. When the database is empty, the first instance is saved with the property correctly set, but ...
Eylen's user avatar
  • 2,647
0 votes
1 answer
910 views

ASP.NET MVC - Dynamic Class Attributes

I'm trying to solve the following problem. I have a base class which stores data, lets say for a Person. When a new Person is created, only some of those details will be filled in via a form i.e. ...
Tom's user avatar
  • 1,071