Displaying 20 results from an estimated 300 matches similar to: "Quick ORM question"
2006 Apr 12
1
Dynamically updating list
hi every body. i am try to do example of agil books.dynamically updating list of chapter 18.
1)this is my code for controller----
class ListnoajaxController < ApplicationController
def index
@items = Item.find_recent
end
def add_item
item = Item.new(params[:item_body])
render(:partial => "item", :object => item)
end
def item
end
end
2)the code for item class in app/model
class
2006 May 01
2
Find by time?
I''m trying to find events created after an initial date. I''m sure it''s
something obvious, but I''m not sure why this isn''t working:
def self.find_recent
find(:all, :conditions=>"created_at > #{Time.local(2006, 4, 27, 22, 0, 0)}")
end
Time for more caffeine for me...
2006 Jun 30
0
redhat being sued over use of ORM/ActiveRecord Pattern in hibernate...could RoR be next?
http://technocrat.net/d/2006/6/30/5032
article mentions RoR...
2008 Nov 17
1
R ORM?
Hi,
Does anyone know of an R ORM (Object Relational Mapper)? I'm thinking of
something similar to sqlalchemy (http://www.sqlalchemy.org/).
Alternatively or additionally, can people offer suggestions about managing
relational databases from R. I'm currently using postgresql, but would
like a flexible solution that works across different databases, hence the
enquiry about ORMs.
Please
2010 May 27
1
Question on Rails 3 : forms && ORM && ActiveModel
I''m a Django/Catalyst user that''s evaluating Rails ... I need a Ruby
framework, and I''m trying to see if learning Rails is worth it or I
should just go for Sinatra + various libs available.
Django has a couple of things I like ...
1) the Forms API
In Django I like that it''s being decoupled from models ... form
objects have fields with validation rules that
2010 Aug 20
2
The M in ORM
Hi everyone,
I am attempting to connect an already existing mysql database with
Rails. For This I can''t use the traditional "generate scaffold" and
"rake db:migrate" because (I think), I''ll loose the data already
existing in that database table. So what I did was, I generated a
scaffold for my table, and instead of running db:migrate, I added a
2007 Aug 23
0
active scaffold polymorphic model
Hi
I am trying to use active scaffold to build a polymorphic model .
I have a number of models that can be featured and I have a Feature model
that belongs_to :item, :polymorphic => true
In my config.columns I include :item_type and item_id, I also added
:item_name to show the name of the record in the form.
In the form, when a type of model is selected I populate the select box for
2006 Dec 05
0
[779] trunk/wxruby2: Added TreeCtrl#traverse method and documentation
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding:
2006 Mar 07
0
Making AR attriibutes private
Hi,
Can anyone tell me the syntax to make AR attributes private so that they
can only be set through an object''s constructor?
I want do something like this, where item_id and rated_by are private
and set only through the constructor:
# Schema as of Mon Mar 06 21:22:59 BRT 2006 (schema version 15)
#
# id :integer(11) not null
# item_id :integer(11)
2006 Dec 23
0
[797] trunk/wxruby2/swig/classes/TreeCtrl.i: Traverse method moved to wxSugar
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding:
2006 Mar 22
1
updating multiple attributes
I have a store administration tool I''m trying to build.
One view is an item view. Each item can have many attributes.
Example:
item: bike
item_id: 2333
attribute: id: 3 #auto-increment
item_id: 2333 #primary key
attribute_type: wheels #a type of attribute
attribute_order: 1 #the order it
2006 Dec 11
2
join and sort on 'best match'
Hi Everybody,
I have been breaking my head on the following problem: how to join 2
tables and sort the results on the best match.
explanation:
- there are 3 tables, items, tags and items_tags. The items_tags table
links items to tags.
- I have one item which has certain tags, and I want to look up all the
other items that have those tags as well
- results should be sorted and presented by
2006 Jan 19
3
problems with migrations in sql server
Is anyone using migrations with a SQL Server database who might be able to
lend me a hand? I''ve used migrations with MySql in the past and haven''t
run into any issues so forgive When I run rake migrate nothing is actually
getting updated in my database. I created a migration using
./script/generate migration AddFooTable and updated the migration to look as
follows:
class
2013 Jan 25
3
how to delete the null elements in list
HI,
I have the list:
> suu
[[1]]
NULL
[[2]]
NULL
[[3]]
item_id prod
1 2
[[4]]
item_id prod
1 2
2 4
how to delete all "NULL" elements from suu to get only
>suu
[[3]]
item_id prod
1 2
[[4]]
item_id prod
1 2
2 4
??
Kind regards,
Tammy
[[alternative HTML version deleted]]
2006 Dec 20
4
undefined method `fullname' for #<User:0x357e380>, BUT works on first view?
Hi all,
Please excuse the long post, but I wanted to make sure you have all the
information....
I have a NewsModel that looks like this:
class News < ActiveRecord::Base
belongs_to :user
validates_associated :user
validates_length_of :title, :description, :minimum => 5, :allow_nil
=> false
acts_as_commentable
acts_as_taggable
def self.find_recent
News.find(:all,
2007 Mar 24
0
Testing Single Table Inheritance
Hi all,
I have just started using Rspec in rails and trying to test the
following models:
>>node.rb
class Node < ActiveRecord::Base
acts_as_tree
end
>>project.rb
class Project < Node
end
>>task.rb
class Task < Project
end
>>milestone.rb
class Milestone < Node
end
Fixtures for table nodes is set global in spec_helper.rb, with the types
set manually in the
2007 Jan 05
0
[832] trunk/wxruby2/samples: Fix samples for TreeItemIds as integers, fix image size in treectrl sample
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding:
2007 Mar 04
3
Dynamically setting the image directory used by attachment_fu
It took me a while to figure this out and I don''t see any wiki pages
for attachment_fu so I figure I would just post this here.
I didn''t like the way attachment_fu by default creates directories
under a given directory for a specific class e.g.
item_image/1/img_1.jpg
item_image/1/img_1_thumb.jpg
item_image/2/img_2.jpg
item_image/2/img_2_thumb.jpg
item_image/3/img_3.jpg
2006 May 03
2
render partial collection
my view contains a call to a partial:
<%= render(:partial => ''item_list'', :collection => @keyword.synonyms,
:locals => { :action_delete => "removesynonym", and_some_other_stuff
})
%>
_item_list.rhtml contains:
<%= link_to (
image_tag(''/images/deletebutton.png''),
{ :action => action_delete,
:id =>
2006 May 03
0
render partial collection passing property
my view contains a call to a partial:
<%= render(:partial => ''item_list'', :collection => @keyword.synonyms,
:locals => { :action_delete => "removesynonym", and_some_other_stuff
})
%>
_item_list.rhtml contains:
<%= link_to (
image_tag(''/images/deletebutton.png''),
{ :action => action_delete,
:id =>