Displaying 20 results from an estimated 10000 matches similar to: "Shelling out from an action with ``?"
2006 Jun 27
3
find_by_id vs. find in postback action
I''m playing around with the Postback action recipe listed in the recipes
book.
Here is the default code given:
def edit
@recipe = Recipe.find_by_id(params[:id]) || Recipe.new
if request.post?
@recipe.attributes = params[:recipe]
redirect_to :main_url and return if @recipe.save
end
end
Here is what my code sort of ended up looking like, altho i''ve ripped it
apart
2005 Jul 12
8
Tip Sheet for AJAX
Hi all,
I''m making an Amy Hoy style tip sheet PDF for the Prototype and
Scriptaculous AJAX stuff, to be used with Rails. Are there other
resources you would suggest besides the websites themselves (the
previous thread about Highlight reminded me of this)? Is there a
particular focus that would be helpful for such a document? Preferred
fonts or colors?
I must say, once you get
2006 May 19
9
[NEW SITE] psitsNOT
psitsNOT ("Photoshop it''s NOT") is an over-the-web image editing
application made with Rails, RMagick, and AJAX. It provides everything
you need to make a raw digital image look good on the web.
http://psitsnot.alevans.com
You''ll need an OpenID URL to log in.
Feedback is welcomed!
--Al Evans
--
Posted via http://www.ruby-forum.com/.
2006 Apr 11
6
Google Base... in Rails?
Ok, so this is kinda out of the blue... but I''ve been looking at
Google Base and thinking that it''s got some really good ideas in it.
Especially the way you can create your own "type" of item with its own
custom attributes, like date range, location, number, text, etc. Kind
of like defining a database with a GUI, but not exactly.
It seems really interesting to me, from
2006 Aug 14
1
Postback Action Problem
I was trying to use postbacks, but its not working.
def edit
@xxxx= xxxx.find_by_id(params[:id]) || xxxx.new
if request.post?
@xxxx.attributes = params[:xxxx]
redirect_to :list and return if @xxxx.save
end
end
I get the following error: SystemStackError in xxxxxController#edit
stack level too deep. The code of list is same as the code generated by the
scaffold
2006 Jul 30
1
Bug? find_by_id(nil) returns object just created
Tried to submit a ticket in Trac, but it reported an error...
Doing a Model.find_by_id(nil) after creating an object of type Model returns
that object -- and the next time, returns nil. It should always return nil.
For example,
Step 1. Create an object:
>> Foo.create(:name => "bar")
=> #<Foo:0x2aaaac3ade20 @new_record=false,
2006 Jul 04
0
Help with first AJAX action
I''ve used Rails for a while, but haven''t really done any AJAX until
now. Now I''ve been fighting for days with my first AJAX action and
after reliably crashing Safari and throwing errors in IE, I''m finally
coming to the list for help. :)
I have a "controls" div in my layout. This div displays a list of
page-specific actions. When some of these
2006 Jul 13
2
find_by_id(nil) does not always return nil
I have a model named User. When running this application from the
console I can call User.find_by_id(nil) and it returns nil. When running
this application during testing or through WEBrick or Mongrel calling
User.find_by_id(nil) returns the newest record in the database. But it
only does this the first time you call it with nil. The second time you
call User.find_by_id(nil) it returns nil.
2007 Mar 07
4
Strange Problem With Unwanted, Transient Caching
Hello,
I hope somebody can explain to me what''s going on here because I''m
baffled!
In a controller''s action I want to create a new order for a
customer. Because I post back to the same action (not RESTful I
know, but that''s for another day) I use code like this:
def edit
@order = Order.find_by_id(params[:id]) || Order.new
...
end
I
2007 Dec 04
1
spec''ing shared controller methods
I want to isolate and spec methods that are shared by controllers,
and live in application.rb.
Whereas I usually also provide examples in individual controllers
that use these methods, not necessarily all the edge cases and I''d
like to isolate the examples.
This is the approach I''m taking (thanks to bryanl for suggestions and
http://pastie.caboo.se/123626). WDYT?
This
2005 Dec 07
3
Addressing a class, rather than an id?
Good day,
I''m trying to use the slider control to resize a pile of images on a
web page. Clever, huh. Bet cha didn''t think of that one!!! :)
But seriously. It seems I want to address a class, rather than the
individual id''s of the images. At this point, I''m getting some
results with something like this:
2005 May 26
1
No response from Apache 2 / fcgi / rails...
Hello! I''m struggling here with getting Typo running on a Red Hat
server under Apache 2 / fcgi... Every time I try to load the public
home page, I get this in my error log:
[Thu May 26 00:20:52 2005] [error] [client 24.22.74.233] FastCGI:
comm with (dynamic) server "/home/httpd/vhosts/brigleb.com/httpdocs/
public/dispatch.fcgi" aborted: (first read) idle timeout (30 sec)
2006 Apr 01
0
Okay, what gives? find_by_id is failing.
This has the look of a "just don''t quite get it yet" problem. I am
using the ActiveRecord.find_by_id method to identify the parent object
(Quiz) to tie to the child object (Question) at create time.
Here is the stdout log:
127.0.0.1 - - [31/Mar/2006:22:43:22 CST] "GET /question/new?
parent_quiz=ff2d7022-be0a-11da-9f01-00400506faf5 HTTP/1.1" 200 806
2005 Jul 31
2
Central list of Rails gems?
Is there a centralized list of Rails gems somewhere? Or even just a
database of some kind of gems that can be useful to Rails apps, not
just specific to Rails?
-raymond
--
Raymond Brigleb, Creative Director
Needmore Designs -- The beautiful, usable web.
Website http://needmoredesigns.com/
Email ray-THGPwszTed5CpjqP0VxSwUEOCMrvLtNR@public.gmane.org
2007 Nov 05
0
Authentication: is a guest a user or an "exception"?
Hi all
I''m currently implementing authentication/authorization in my app. Now
I''m wondering what''s the common way to handle a guest...
In fact, many of the visitors of my app will be anonymous users that
just want to read articles etc., but one can register as a member to
have some further possibilities. So far one can login as a member and
from this point on one has
2006 May 30
0
Single table lookups
I''m struggling with a single table type (self) lookup.
my ''personnel'' model has a supervisor_id and is_supervisor column.
The supervisor''s select list is created by
@supv = Personnel.find(:all,
:conditions => ["is_supervisor = true"],
:order => ''last_name'')
in my personnel model, I have the following...
def
2010 Mar 10
0
Rails ActiveRecord associations autosave option
I have the following associations.
class Document < ActiveRecord::Base
has_many :document_sections, :dependent => :destroy, :autosave => true
has_many :document_items, :through => :document_sections
end
class DocumentSection < ActiveRecord::Base
belongs_to :document
has_many :document_items, :dependent => :destroy, :autosave => true
end
class DocumentItem <
2005 Jul 12
6
Meta-question about the list
Question about the list in general: by default, it''s set up so that
replies go to the sender, rather than the list. However, on other
lists I usually chat on, replies by default generally go to the list.
This seems to encourage more discussion. Would it be a good idea to
change that default? Or am I just crazy.
Best,
Raymond
--
Raymond Brigleb, Needmore Designs
Website
2012 Aug 01
2
'redirect_to' taking infinite loop.
Hi,
The following controller method taking me into infinite loop. Once the
update action completes I want to reload the ''index'' page. May I know
why it is going into infinite loop?
def update
Device.find_by_id( params[:device_id] ).driver = (
params[:driver_id] == 0 ) ? nil : Driver.find_by_id( params[:driver_id]
)
redirect_to :action => :index, :tab =>
2006 Mar 01
2
Validating that a foreign key is present and ok
How do I validate that a model object''s attribute is a valid foreign
key? The problem is, I can''t check if the attribute is a valid foreign
key if the attribute doesn''t even exist.
For example, every employee must be in a department. In the following
code, if an employee''s department_id is not present then
Department.find_by_id(department_id) might cause