Displaying 20 results from an estimated 10000 matches similar to: "Newbie question on id"
2006 Jun 26
8
id of last element in a table
Hi,
I would like to figure out how to determine what the id of the last
element in a table is. Is there an equivalent to the Table.find() method
which will tell me the number of elements in a table? also, maybe more
importantly, where are the available methods on tables documented?
What i am trying to do is to increment the id and work through a table
and check whether the id i am currently
2009 Sep 07
11
autoincrement for non-id column
There is a table:
execute (<<-SQL)
CREATE TABLE "tasks" (
"id" serial primary key,
"number" serial,
"version" integer DEFAULT 0 NOT NULL,
"latest_version" boolean DEFAULT ''t'' NOT NULL,
"hidden" boolean DEFAULT ''f'' NOT NULL,
"type" character varying (1) NOT
2006 May 22
15
collection_select default selected value
Hiall,
Unfortunately I just can''t find out how to setup a default selected
value when using collection_select. My call is like so:
<%= collection_select(:consultant, :lastname, @consultants, :id,
:lastname, { :selected => @current_consultant.id } ) %>
which is not working, I debugged so far that I know that
@current_consultant.id contains the correct value.
Any tips?
cheers
2006 May 26
5
scriptaculous - auto complete textbox with a drop down
Hi,
I''m using scriptaculous to provide an auto complete textbox - and it
works perfectly - but I was wondering if there was anyway to let users
navigate the choices using the keyboard i.e the curor keys as opposed to
having to use the mouse? Apart from that it''s perfect! :)
Cheers,
Pete
--
Posted via http://www.ruby-forum.com/.
2006 Apr 05
23
how to create RJS visual effects callbacks
I''m trying desperately to get visuall effects callbacks working in rjs
templates to no avail What I''m trying to do is fade an image, change
the div with the image to a new image, and then fade the new image back
in. How would I go about this in RJS Here''s a simple line from my rjs
that I can''t get to work. It is not using callbacks so the
2006 Jun 21
7
acts_as_taggable and paginate?
Hi there,
I''ve been trying to paginate over a list of members that all share a tag in
common using the acts_as_taggable plugin. The regular way of paginating over
a collection doesn''t seem to work with acts_as_taggable. Here''s what my
method looks like that takes in a tag name, finds all the members that share
the tag and then displays all the members. Nothing too fancy
2006 Jun 04
5
Embedding link_to''s within text fetched from database.
Hi,
I have the following problem that I can''t seem to figure out. I want to
able to fetch some text from my database record in my controller, and then
add two links within the text and then send that back to the view to get
rendered so that the two links appear as links and when clicked on, they''d
basically call the corresponding action for the link. Would anybody know
how to
2006 Jul 15
12
Safe way to destroy records
Hello,
how can I check if a destroy was successful?
Is the object only frozen if deleted or do I have to do an additional
find to see if there is a record left?
What happens if an after_destroy callback returns false? Is there always
a rollback?
Markus
2006 Apr 23
37
Newbie .. nil object and missing something obvious
Trying to do first project in Ruby on Rails, and I''m getting the dreaded
nil object exception. I''ve reduced the code to what I think is the
minimal case, and it''s still not working. Code presented below..
----------------------------------------------------------------------
in "app/controllers/dashboard_controller.rb"
class DashboardController <
2006 Jun 18
3
on change of drop down a textfield emerging
hi,
i have a situation where i have a list of options from which a user selects
his options if its not in the list he/she selects Others/Not Present and a
new textfield should pop up and the data entered there should be considered
instead of dropdown.
i have done this using javascript/dhtml but i was wondering how this can be
done using pure rails i.e using some of the RoR apis?.
i would
2006 Mar 09
4
Testing Migrations
Is there some standard way to test migrations?
It seems to me that an additional safeguard for migrations would be to
test and see if applying the migrations to the test database allows one
to reconstruct the structure of the development database.
If you can''t, then there is an error in your migrations, most likely
because someone hand-modified the database without generating a
2006 May 24
3
using a helper from the console
I''ve got a couple of helper functions in my application_helper file that
I would like to run from the console (for debugging).
What is the correct way to invoke a helper from the console?
_Kevin
--
Posted with http://DevLists.com. Sign up and save your mailbox.
2006 Jul 14
5
Ideas for AJAX pagination
Hi,
I am looking for ideas on how to remove the last item from a
paginated page when a new item is inserted, thus leaving only 10
elements on the page.
Currently I have a form that inserts with AJAX, but as expected, each
post added to the page just increases the number of posts leaving 11
on a page that should only be displaying 10.
I have unique ID''s for each post (e.g.
2006 May 04
12
RJSCallback 0.1
Announcing RJSCallback 0.1
The RJS Callback plugin is being developed to provide Ruby On Rails with
the ability to easily call RJS templates for the various callbacks
associated with AJAX function calls (e.g., :before, :loading, :complete).
Currently this plugin automatically detects, loads, and renders RJS
templates with specific names and inserts them in the appropriate spot
in
2006 Aug 02
5
Fun with ez_where
I''ve been trying to use the ez_where plugin to create a dynamic finder.
The structure looks somehing like this..
=== controller ===
def list
attribute_filter = params[:filter]
@filter = Caboose::EZ::Condition.new :table do
attribute <=> attribute_filter if attribute_filter
end
#
... do the find with the @filter
#
end
=== view ===
....
<%= link_to
2006 Feb 08
3
Using shared RJS templates
I''ve got an action in my application controller that needs to call a
shared RJS template. Typically it''s actually being called by subclasses
of the application controller.
I''ve tried this..
def action
...code..
render :partial => "shared/template"
end
with ''_template.rjs'' existing in the shared folder.
The problem that crops
2006 May 19
37
OS for rails development: Windows vs. Mac?
Caveat: this is not a discussion about *hosting* a rails app on windows.
Anyway...Macs are everywhere you look when researching rails (demo vids,
tutorials, and pictures from rails training classes). I''m interested in
what the pros to using a Mac for rails development are (besides
textmate). Is it more of a cultural thing, a what would 37 signals do
thing, is it a unix thing, or
2006 Jun 19
10
text_field_with_auto_complete doesn|t work in edit/show view
Hi,
I am using the autocomplete for text field with ''Scriptaculous'' and it
works perfectly fine in "new" action.
All the examples I see are only for the "new" action.
But doesn''t default to the selected value/text in "edit/show" action? Is
this possible or should I write custom code for "edit/show" action?
Thanks, Hari
--
2006 Feb 08
3
RJS templates before, during and after
RJS templates are nifty. They let you put all sorts of fun effects all
over your bland html pages without too much work.
The link_to_remote function also lets you run scripts before, during,
and after an AJAX call is run by using callbacks.
There does not seem to be an equivalent method for running an RJS
template before or during an action. Rendering it at the end is no problem.
One
2006 Apr 11
9
rails equivalent to asp''s Application object?
In asp you have an Application built-in object, which works just like
the Session hash, but it lets you share information among all users of a
given application.
which is the rails equivalent???
and if there isn''t, how would you implement such a thing ? (there would
be concurrency issues to take into account, in fact asp''s application
object has some lock and unlock methods