Displaying 20 results from an estimated 8000 matches similar to: "Application Design"
2007 May 11
3
is_active?
Hey all, i''m rather new to rails and was curious if ActiveRecord
implemented anything like is_active where the delete functions would
just mark records as inactive, vs deleting rows. (similar to created_at,
etc). I need a history of transactions, and this is how I would code in
other languages. Any advice? Is there are smarter way to implement this?
Thanks in advance!
--
Posted via
2010 Apr 12
2
[PATCH] Access to more Arel predicate types from where condition hash
I could use some eyes on https://rails.lighthouseapp.com/projects/8994/tickets/4368
if anyone has the time.
Summary of the change:
Similar to PredicateBuilder''s existing support for ''table.column'' =>
''value'', this patch enables ''column#method'' => ''value''.
For instance,
2008 Mar 07
3
Boolean circles..
Hi,
This is just kindof a RoR question, but since you all potentially do
the same things as I do, I thought I''ll ask here..
Im trying to use the boolean type in the database. Migrations is no
problem, it even converts the 0/1 values from my import CSV to false
and true.
However, I cannot make the :conditions part of a find work:
Loading development environment (Rails 2.0.2)
>> c
2006 Mar 01
6
How to retrieve attributes from HABTM?
We have tables Users and Communities linked by has_an_belongs_to_many.
The join table Communities_Users has additional fields [ is_active,
is_blocked, join_date] etc. These are populated using
@user.push_with_attributes(:is_active => true,...).
Later on how do we update or retrieve the attributes in the link table
for a given user or a community with doing it explicitly using SQL?
Thanks,
2006 Jul 24
7
[PATCH] Support for DB Clusters/Replication in ActiveRecord (RFC)
Skipped content of type multipart/alternative-------------- next part --------------
Index: connection_adapters/abstract/connection_specification.rb
===================================================================
--- connection_adapters/abstract/connection_specification.rb (revision 4617)
+++ connection_adapters/abstract/connection_specification.rb (working copy)
@@ -1,10 +1,21 @@
require
2006 Aug 10
1
Convert datetime_select to Time object?
--------------------------
Question 1
--------------------------
I am dealing with a database that holds products and it has a datetime
field called "active_at". so I have the following for active_at:
<%= f.datetime_select :active_at %>
It gives me 5 different params:
params[:product][:active_at(1i)]
params[:product][:active_at(2i)]
params[:product][:active_at(3i)]
2006 Apr 20
5
acts_as_taggable patch 3866 needs some testing
DHH''s acts_as_taggable is now much more usable with this patch.
http://dev.rubyonrails.org/ticket/3866
This patch adds scoped finders, documentation, and tests:
# Get tags for all articles in a blog
@blog.articles.tags
# Get tags for articles in a blog published in the last year
@blog.articles.tags :conditions => [''published_at > ?'', 1.year.ago]
# Get related
2006 Mar 21
8
How to avoid multiple submits/posts?
Hello,
How do I prevent previously submitted form data from being reinserted into
the database when the user presses the browser''s Refresh button?
On Aughey''s advice in #irc I tried using `redirect_to'' a new `:action'' but
this approach doesn''t seems to work.
Any idea what might be wrong or how to tackle this problem?
Thanks for your help.
P.S.- I
2010 Aug 05
3
how to ? Rails 3 ActiveRecord eager loading and AREL
Hello everyone,
I would like to eager load scoped records to avoid queries executed in a
loop (huge performance impact).
The "scoped" part is what is giving me a hard time.
I''m using Rails3 RC.
Does anyone have any idea how I can do it?
Here is a test case : we have an "Article" and a "Comment" Activerecord
models,
article has many comments
comment
2012 Apr 17
6
ActiveRecord with different Date/Time format
I have an application where user sets his/her preferred date/time
format. User is expected to enter datetime in his preferred format
across the application. Now the problem is for few formats the datetime
is parsed wrongly while create/update ActiveRecord.
For example user has set date/time format in hh:mm dd/MM/yyyy. Now if
user enters 17:00 04/05/2012 it parses it as 5 PM 5 Apr, 2012 where it
2007 Jul 19
3
Merb::Controller#url Usage
I have a question about the usage of Merb::Controller#url. When I
have nested resources, requesting the new action works differently
than I expected. I was wondering what the intended usage is.
For example:
Say I have
r.resources :articles do |article|
article.resources :article_attachments
end
irb(main):002:0> show_routes
[:articles, "/articles"]
[:article_attachments,
2009 Jul 28
1
Rails date conversion
The environment.rb file in a Rails 2.3.2 app says:
> Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
Auto-convert to this zone... when?
Also, what are the differences between these two statements?
config.time_zone = xxx
config.active_record.default_timezone = xxx
I ask these questions because I have a scenario whereby an AR-backed
object, when
2008 Jul 30
2
Mysql "lock wait timeout" tuning
We''re seeing these errors intermittently:
###
Mysql::Error: Lock wait timeout exceeded; try restarting transaction:
UPDATE `chairs` SET `published_at` = NULL, `updated_at` = ''2008-07-30
15:31:05'' WHERE `id` = 2147
[RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/
connection_adapters/abstract_adapter.rb:147:in `log''
###
The root issue is probably
2007 Nov 29
4
collection.build or collection.create gives "ArgumentError: wrong number of arguments (1 for 0)"
I have a Project that has_many Tasks. Tasks belongs to a Project. When
I try the following:
project = Project.new
project.tasks.build
I get:
>> s = Project.new
=> #<Project:0x25f9e28 @attributes={"name"=>"", "end_at"=>nil,
"updated_at"=>nil, "published_at"=>nil, "user_id"=>nil,
2015 Oct 05
1
Dovecot don't erase mails from storage.
Hi,
I have a dovecot installation with a strange problem: all the mails stays
in storage after deleted from users mailbox. If user logon after the mails
are deleted, they don't receive them any more, but the m.## files aren?t
deleted. This happens with pop3 (default for this installation) and/or imap.
The dovecot is installed along postfix with mysql and multi-domains support
Here's the
2006 Feb 25
1
RJS and File Uploads
Does anyone know how to handle file uploads with ajax forms? I''m using
rjs.
--
Posted via http://www.ruby-forum.com/.
2007 Jul 24
9
will_paginate plugin doesn't work with Association Extensions?
I have:
class Post < ActiveRecord::Base
has_many :comments do
def published
find( :all,
:conditions => {:published => true} )
end
end
end
When in my controller I do
Post.find(:first).comments.published.paginate :page => params[:page]
I get an error
undefined method `paginate'' for []:Array
Is will_paginate supposed to
2011 Feb 05
3
ActiveModel::AttributeMethods limiting
In my attempt to add AM:Dirty to my model I realized that
AM#AttributeMethods is a bit imperfect. It''s impossible to generate
attribute methods step-by-step in DataMapper-like manner.
class Model
include ActiveModel::Dirty
def self.property(name, klass = String)
define_property_accessors(name, klass)
# This method will be called once, because of
2014 Jan 09
2
How to read IRQs and timing slips values
Hi,
On a Asterisk 1.8.12 system working OK for months (>100k calls proceed),
users are complaining for bad audio.
My setup is:
PSTN <--E1/PRI ---> Asterisk <--- E1/PRI---> Siemens HiPath <---E1/PRI
---> PSTN
asterisk -rx "dahdi show version"
DAHDI Version: SVN-trunk-r10414 Echo Canceller: HWEC
asterisk -rx "pri show version"
libpri version: 1.4.12
A
2015 Sep 24
4
Xorcom T1 to PRI
Hi,
I have a client that has a 24 channel voice T1 that I have been using
e&m signalling over for a number of years. The local telco finally got
an ISDN switch and wants to move them to PRI. I didn't see this as a
big problem - I've done a few others on this particular Caribbean island
without issues, but this would be the first time with a Xorcom unit
involved.
We tried to do