Questions tagged [dynamic-attributes]
The dynamic-attributes tag has no usage guidance.
32
questions
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 ...
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
...
>...
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 ...
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)
...
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....
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 ...
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 ...
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" %>
...
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 ...
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 ...
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, ...
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 "...
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"
....
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 ...
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 ...
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 ...
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 ...
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 ...
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 "...
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 ...
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 ...
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"=>"✓...
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 ...
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; ...
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 ...
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:...
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 `...
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 ...
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 ...
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: ...
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 ...
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. ...