Displaying 20 results from an estimated 2000 matches similar to: "Named scope in named scope ??"
2009 Oct 07
2
Rails, flash, function and parameter
Hi,
I try do update the flash on my page with ajax.
I have this on my layout :
<div id="flash_messages">
<%= render :partial => ''layouts/flash'' %>
</div>
I have this on my ApplicationHelper :
def reload_flash
page.replace "flash_messages", :partial => ''layouts/flash''
end
and I try do that on my controller :
2010 Mar 27
1
ar_mailer, class Email : add field to the table?
Hi,
I use ar_mailer to send emails from my application.
I want to build a page where the admin case see the queue of mails and
the possibility of remove some mail in the queue if he wants.
The email in the queue are save in the AR model Email.
I have an AR model Sent where i save the email that the user sent.
I would like to add to the model Email a column to save the id of the
corresponding
2010 Jan 04
3
Generate PDF
Hi !
I need to create some pdf from my application. I have a table people
with a field address and I need to generate a pdf of label of each
address ( I think 10 labels per page). The pdf can have around 500
pages.
Which library should I use to do it ? I read some information about
different library to generate pdf but I don''t know if all library are
a good choice for generate
2010 Jun 24
3
DRY a named scope
Is there a way to DRY this up a bit?
named_scope :has_valid_sysoid, lambda{|sysoid|
(sysoid.nil?) ? {:conditions => ["nodesysoid IS NOT NULL AND
nodelabel LIKE ''%-to-%''"], :include => [:ipinterface, :alarm]} :
{:conditions => ["nodesysoid IS NOT NULL AND nodelabel LIKE ''%-to-%''
AND nodesysoid = ? ", sysoid], :include =>
2009 May 12
4
has_many :through and scopes: how to mutate the set of associated objects?
I have a model layer containing Movie, Person, Role, and RoleType,
making it possible to express facts such as "Clint Easterbunny is
director of the movie Gran Milano".
The relevant model and associations look like this
class Movie < ActiveRecord::Base
has_many :roles, :include => :role_type, :dependent => :destroy
has_many :participants, :through => :roles, :source
2009 Jul 23
11
Problem with named_scope
Here are my scopes:
default_scope :order => ''posted_on DESC'', :conditions => { :status =>
''visible'' }
named_scope :positive, :conditions => { :rating => ''positive'', :status
=> ''visible'' }
named_scope :neutral, :conditions => { :rating => ''neutral'', :status
=>
2010 Feb 11
3
Parameterized ActiveRecord Associations: Any such thing?
Hi list, how are ya?
So, my current project is just begging for the ability to have
parameterized associations in my ActiveRecord classes. Basically I
need something that is a cross between named scopes and standard
associations (has_many specifically).
I''m wondering if such a thing exists or, if not, if anyone else has an
elegant, equivalent solution?
Example:
class Sprocket <
2010 Sep 01
4
deprecation warning in Rails 3 about Base.named_scope
I recently upgraded to Rails 3, and this error has come up
ubiquitously:
DEPRECATION WARNING: Base.named_scope has been deprecated, please use
Base.scope instead.
Any ideas on how to get rid of it? Or should I just wait for
something?
There''s actually no place in my application where the code
"Base.named_scope" exists, so I assume the problem is inherent in gems
that
2009 Jul 11
2
offeride :limit named_scope default_scope
Hi,
Rails 2.3.2
class TestD < ActiveRecord::Base
default_scope :limit => 12
named_scope :limit, lambda { |num| { :limit => num} }
end
ruby script/console
>> TestD.all
TestD Load (0.7ms) SELECT * FROM "test_ds" LIMIT 12
=> []
>> TestD.limit(14)
TestD Load (0.3ms) SELECT * FROM "test_ds" LIMIT 12
=> []
Any ideas why the default limit
2005 Apr 12
7
Samba question
1. Does anyone know what may be happening here? When I try to map a
drive from a PC, I get the following error: "The account is not
authorized to log in from this station.". I can map the drive just fine
from my PC. Does anyone know what may be going on here? Any help would
be greatly appreciated.
2. Also, whenever I use SWAT, it takes a long time for the
information to be
2010 Jan 15
1
Chaining queries in ActiveRecord
Hi all,
Stuck at this problem for several days. Tried to use named_scope,
scope_out, and plugin such as searchlogic, but no result.
The problem is as follows: I have a pic table and tag table, and a
join table called pic_tag (with only pic_id and tag_id) so that I can
associate N pics to M tags. This is the tutorial way to set up a many-
to-many association. I''m trying to implement a
2008 Jun 03
1
Custom counter cache
class Category
has_many :tracks
end
class Track
belongs_to :category, :counter_cache => true
named_scope :converted, :conditions => {:converted => true}
named_scope :active, :conditions => {:active => true}
end
I want to make custom counters for scoped associations, e.g:
category.converted_tracks_count
category.active_tracks_count
And when `track` changes its converted,
2010 Apr 07
3
Recommendation for searching with regards to timestamp & foreign key attributes
hi guys,
I need a recommendation for searching with regards to timestamp &
foreign key attributes. Sounds
a bit too much but here''s an example.
Suppose we have a "blog" object. It has many attributes such as
- title
- content
- status_id
- created_at
- updated_at
There are also "status" objects which have the following statuses,
"new",
2009 Feb 18
2
Tables
Are there any standards emerging for how to represent tables in Markdown?
Regards,
- Daniel
--------------------------------------------
Dr Daniel Winterstein
Winterwell Associates Ltd
tel: 0772 5172 612
http://www.winterwell.com
Registered in Scotland, company no. SC342991
2005 Sep 19
6
SIP audio port usage
Hi,
I know that SIP is using port 5060 for session initiation, but which port
does it use for audio ? is it dynamically assigned ?
Thanks,
Adrien
--
Adrien Laurent - CIO
www.modulis.ca
514-284-2020 ext 202
adrien@modulis.ca
2008 May 22
14
Specifying certain tables NOT to be cleared each example?
Is it possible to specify that certain tables not be cleared on each
example.
I''ve inherited a project where a good amount of enumerated data is
stored in the database (US States, statuses, about 15-20 tables worth.
Over all, it''s a reasonable decision that leads to solid production
code (acts_as_enumerated is good). This data is read-only and
relatively static; any
2008 May 13
6
Testing that named_scope is defined
Hi guys,
I''m just beginning to use RSpec and I ran into the issue of testing a
named_scope. I''m not actually trying to test its behavior, as it''s not
my code, but I wanted to test at least that it''s defined. I tried
doing this:
describe Post, ".most_recent" do
it "should be defined" do
Post.method_defined?(:most_recent).should be_true
2009 Nov 01
1
please help - complicated polymorphic association
I am trying to build a shared-appointment system, where users can
subscribe to appointments and be updated whenever changes are made to
them. I have three objects in this system, appointments, users, and
subscribers. Subscribers are a polymorphic object like so:
class Subscriber < ActiveRecord::Base
belongs_to :user
belongs_to :subscribable, :polymorphic => true
end
The tricky part is
2010 Jun 26
4
Time-dependent values/constants in Models: An issue or not?
Hi there,
I remember reading in the comments of a Rails blog something along these
lines:
"Since a Model is loaded only once in production development (at server
start), certain time-dependent ''constants'' that you have placed in a
method of a Model will always return the same value for those
''constants'', i.e. the value the ''constant'' had
2020 May 13
3
Sometimes commands do not terminate after upgrading to R 4.0 and Ubuntu 20.04
I have upgraded R (from 3.6 to 4.0) and RStudio (from 1.1 to 1.2.5) a few
days ago, and Ubuntu from 18.04 to 20.04 yesterday.
Since then, R sometimes never terminates when executing certain commands:
ivreg (from package AER), summary (of a logit regression) and logitmfx
(from package mfx). Sometimes these commands run fine, but most of the time
I have to kill the process because R won't