Displaying 20 results from an estimated 20000 matches similar to: "Linking to "Next Entry >>" from the current Entry Page"
2006 Aug 02
9
How to fetch the previous or next record
Hello,
Is there some built-in facility for fetching the Previous or Next record
from a table? Assume the command find_by_name has been issued, and the
variable @name contains the name "John Doe". I''m looking for something
like find_next(@name) and find_previous(@name). What''s a good way to
pursue if one has to roll their own methods?
Thanks for the help,
gk
--
2006 Aug 09
10
Next/ Previous record
Hi, Quick question (which means that I think there should be an easy
answer)...
When I am in the "show" view, I''d like to add 2 links, one for previous
and one for next record so that the user can go on to the next "result"
without having to go back to the ''list'' of results. However, I can''t
find my way about this problem :-S
2007 May 01
3
ActiveRecord Previous/Next Record
Does ActiveRecord offer a simple solution to get previous/next records
relative to a certain record? For instance, say I have this table:
PEOPLE
id | name
1 | john
2 | mary
3 | bob
Using p = Person.find(2), is it possible to get the previous (john)
and next (bob) records using perhaps something like p.previous and
p.next? If not, how can I do this without resorting to ugly queries?
Thanks in
2006 Apr 12
2
Collection has next question
Hi,
I know about pagination but dont want to use that option if it all
possible.
How in a collection of posts can i check if the there is a next item in
the collection and then add that an object.
For instance:
//Returns all the posts into a collection called posts
@posts = Post.find(:all)
//Returns a specific post based on an id
@post = Post.find(params[:id])
//How can i return the next
2006 Mar 30
2
acts_as_ordered plugin
Hey all,
I''ve just put together a little plugin to easily access the neighbours of a
given model in a particular order. Read on if interested.
Install:
script/plugin install
http://svn.viney.net.nz/things/rails/plugins/acts_as_ordered
Usage:
class Person < ActiveRecord::Base
acts_as_ordered :order => ''first_name''
end
Say you have people with first
2008 Oct 28
7
aasm callback order?
Hello!
Sometime ago I ran across a webpage where someone had identified the
full callback sequence for an object lifecycle including AASM with
it''s :enter and :exit and whatnot callbacks. Unfortunately, I can''t
find it and searches don''t seem to help.
Does anyone have a reference to a page that shows the callback
sequence with Acts As State Machine (the gem)?
I think
2008 Apr 04
6
validates_numericality_of :not_equal_to
I have a situation in which I want to validate a number is not zero.
Both positive and negative values are acceptable, just not zero.
validates_numericality_of has an :equal_to attribute, but I don''t see a
:not_equal_to. I have not yet been able to find anyone who has
discussed this. I did find information about custom validators, so I am
now using a custom validator to check the field
1998 Dec 15
3
how can i find out a netbios name from an IP address.
i install quite a few (debian linux) internet gateway boxes with samba
installed so that the client can get their /var/www directory in network
neighbourhood.
in order to diagnose network faults (i.e "WTF can't the stupid doze boxes
see/login to/etc the samba share?"), i often need to find out the netbios
name of a machine. for some reason this seems to an extraordinarily
difficult
2013 Jun 22
2
[PATCH] pygrub/GrubConf: fix boot problem for fedora 19 grub.cfg
Booting a fedora 19 domU failed because a it could not properly
parse the grub.cfg file. This was cased by
set default="${next_entry}"
This statement actually is within an ''if'' statement, so maybe it would
be better to skip code within if/fi blocks...
But this patch seems to work fine.
---
tools/pygrub/src/GrubConf.py | 2 ++
1 files changed, 2 insertions(+), 0
2007 Sep 11
1
Chan_sip Entry
Hello,
I am trying to get to Jain Sip softphones to call one another via an Asterisk server. When I call from phone 1 to phone 2 there is audio transmission both ways, but when I call from phone 2 to phone 1 I don't get audio transmission and reception both ways. When I look at the asterisk log file it has an entry which says:
"Oooh, format changed to 2".
Would anyone know why
2009 Mar 27
1
using pagination to group pages by attribute value
Hi -
I''m trying to group records based on some attribute they or an
association of their''s have. The simplest example I could think of to
drive my point is this:
Assume the following model associations (pardon my butchering of rails)
-
Faculty has_many :courses
Course belongs_to :faculty
I want to paginate courses based on the name of the faculty they belong
to.
The paging
2009 Mar 06
5
ActionMailer Layout on HTML version not Plain Text
I''m sending plain text and html emails by having multiple files for each
email I send. For example, for my registration email I have a
registration.text.plain.erb file and a registration.text.html.erb file.
I want to use a layout for the html version of my emails. In my mailer
I put:
class AccountsMailer < ActionMailer::Base
layout ''email''
...
end
2009 Mar 26
1
Turning off the layout in ActionMailer?
So I''m happy to see that ActionMailer supports layouts now (it may
have for a while, but I just now realized it).
But I don''t see a way to turn them off selectively or by multipart
type.
For example, if I have a layout that''s really simple in "layouts/
email.html.erb":
<div style="border:1px solid gray">
<%= yield %>
</div>
I
ANNOUNCE: act_as_soft_deletable - new rails plugin for soft deleting / disabling ActiveRecord models
2008 May 15
13
ANNOUNCE: act_as_soft_deletable - new rails plugin for soft deleting / disabling ActiveRecord models
Acts_as_soft_deletable is a rails plugin that provides the ability to
soft delete or disable models.
When models are destroyed, they will be archived so that they can
later be restored easily. Its similar to acts_as_paranoid but uses a
different approach that should make it a little more foolproof.
See the README at the following url for a better description.
github url:
2009 Mar 27
3
ANNOUNCE: Hirb - A gem enhancing your script/console
Hi,
I''m announcing Hirb, a mini view framework which enables script/
console to provide custom views.
Out of the box your activerecord objects come back as ascii tables.
You can also configure your tree-based models to return as ascii
trees:
Numeric
|-- Float
|-- Integer
| |-- Bignum
| `-- Fixnum
|-- Date::Infinity
`-- Rational
I''ve written two tutorials on
2008 Apr 03
3
Overloading and wrapping an association method
Hi all:
For example I have:
class Color < ActiveRecord::Base
belongs_to :ball
end
class Ball < ActiveRecord::Base
has_many :colors
end
What I want to do is to write a method that:
1. takes the result of Ball#colors, which is an array of Color objects
2. do something with the array
3. return the result
but I want to name my method Ball#colors, i.e. I want to overload the
generated
2008 Apr 10
3
New to ruby, Need help
I''m attempting to make a simple program, just combine two images and
output a .jpg file. Here''s what I have:
class PicController < ApplicationController
require ''RMagick''
def index
im1 = Magick::Image.read(''1.jpg'') {self.size = "81x81"}.first
im2 = Magick::Image.read(''2-1.jpg'').first
result = im1.composite(im2,
2007 Jan 30
5
Asterisk dual contexts stupidity
So I have my extensions.conf
(http://www.infiltrated.net/exten.stupidity.conf) shortened
in case someone wants to look. Has someone encountered the following?
I've racked my
brain on this for too long...
I have two contexts, day and night...
Caller (Daytime) --> Dials an extension --> Caller hears extension ring
on receiver --> Call goes through
Caller (Night) --> Dials an
2006 Sep 06
22
ROR host: dreamhost or godaddy?
hi all,
i am looking for a host for my ROR web app. the target audience will be
70% from mainland china, and 30% from the rest of the world.
i dont want a chinese hosst because:
1. it''s very slow for the rest of the world to access to it.
2. the speed is quite ok for china to access the us sites.
both dreamhost and godaddy provide similar budget plans, and i saw them
all from this
2008 Apr 11
2
Validating an ActiveRecord object and its has_many :through associations
Considering an object with several has_many :through => associations,
what is the ''best'' way to handle validations?
As an example:
class Student < ActiveRecord::Base
# some attrbutes like
# :name
# :grade
# relationships
has_many :students_assignment, :dependent => :destroy
has_many :assignments, :through => :students_assignment
has_many