I have an Expando model kind in my App Engine datastore and I'm setting many arbitrary property names. I didn't consider that I couldn't store Unicode property names, and now I'm in a troubling situation where any attempt to fetch entities of this kind, or even deleting them to get rid of the offender get the following error:
Traceback ...
Hi, I need to display error message on model in rails,
my coding on model is like this,
if my_address.valid?
# I need here the validation error.
return nil
end
I used errors.add("Invalid address") but it is not working
please help to solve this problem ,
...
Hello.
In my controller, I have this:
user.save
if user.leveled_up==true
flash[:notice]="HOOOORAY!!!"
end
and in my model I have:
before_save :check_xp
# ....
def leveled_up=(leveled_up)
@leveled_up=leveled_up
if @leveled_up==true
self.statpoints+=5
hp=max_hp
end
end
def leveled_up
@le...
Sigh... I feel like a big newbie on this one, so lets say I have a few models:
class Question < ActiveRecord::Base
has_many :answers
belongs_to :user
end
class Answer < ActiveRecord::Base
belongs_to :question
has_one :user
end
class User < ActiveRecord::Base
has_many :questions
has_many :answers, :through => :questions
end...
Has anyone done this? I'm confused at how I can make this work, first off I have my user model
Geocoding with it works fine in IRB, just can't figure out how to get it to work in my project.
Trying to use some examples from the readme here: http://github.com/andre/geokit-rails/tree/master.
Anyhow here is what I have:
class User < Act...
I'm experiencing a critical problem with my App Engine datastore, and it seems to be completely immune to debugging: I'm unable to modify entities after constructing them.
The problem is even present when working from a console defined in app.yaml that does not share any code with my main application. Here's an example from the console...
I have a trouble trying to get this working. I have an Item model, and each Item can have other items or nothing.
So is this possible or do I need to do some magic?
...
I'm currently designing solution where the domain model & the repository can be extended by application plugins. Now, i have come across a few issues that i am listing below.
My first issue is making domain model extensible. I was thinking about using inheritance here, but honestly, i have no idea how i can leverage multiple plugin ass...
How to remove Field Name in validates_presence_of on rails Model for the following coding
validates_presence_of :address, :attributes => true, :discard_if => :invalid?, :on => :save, :message=> "Invalid Address"
and the Output is
Address Invalid address
and I don't want Address field in this validation
Please Help me to solve th...
I'm not sure if this question is non-sense or not, please tell me if so. I am wondering do I create my models like one per each table in my database, or do you do one per controller? Is there something I am missing here?
From what I read the Model is suppose to be a representation of the real business objects, so would I just want to ma...
I'm tinkering with adding a model layer to an iPhone application so that I can serialize/prioritize HTTP requests and selectively cache responses. Thanks to UIWebViewDelegate, the following method makes this fairly straight forward (in theory):
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navi...
In my block code I am trying to programatically retrieve a list of products that have a attribute with a specific value.
Alternately if that is not possible how would one retrieve all products then filter them to just list the products with a specific attribute?
...
I need to store various info about some movies, books, games, and maybe other media. Starting from publisher to disc count in DVD-box. At first i thought about abstract Item model, with children Book, Movie, Game. But it's all hard-coded and not very scalable, i think. What if i would need to add some new item type?
Then I've read abou...
I'm creating an in-house diagnostics application for a product that has a bunch of individually addressable devices on an I2C bus.
The general idea is that I query each device on the bus and obtain a byte array of 'raw data'. The length of the byte array depends on the individual device.
I've created an abstract class called 'Form...
I have model like this
class Vote < ActiveRecord::Base
after_save :add_points_to_user
.....
end
Is it possible to somehow force model to skip calling add_points_to_user when saved? Possibly something like ActiveRecord#delete vs ActiveRecord#destroy?
...
In the same way that Articles can have a relationship with Sites (OneToOne/ManyToMany), I'd like to be able to assign a User permission to work on a certain Site (or Sites).
...
Here's a little background on my solution:
ASP.Net MVC app
Using Linq-to-SQL with table-per-hierarchy inheritance
Using DataAnnotationsModelBinder as default
So I have a Device abstract class and then a series of derived classes (ServerDevice, DiskDevice, PSUDevice, etc) that inherit from it in the proscribed Linq-to-SQL way. I have...
I built a basic search form that queries one column in one table of my app. I followed episode 37 Railscast: http://railscasts.com/episodes/37-simple-search-form. Note I just posted another search related question, but it's on a completely different issue.
In my app, the search queries the zip code column of my profile table, and retur...
I have a list of Product objects ( as rows ), each object has several data fields ( like product id, product family, etc ) - as columns. I managed to create a table model subclassing QAbstractTableModel, and display the datas in a QTableView.
What i want is provide a "grouped" view of the model in a tree-like structure. For example I wa...
I do not have much experience using frameworks or anything so that leaves me with little experience using Models (MVC). I have no interest whatsoever in using a framework at the moment. I am working on a website and I am trying to model some objects but I'm not sure exactly how I should be designing the class.
For instance, right now I ...