similar to: How to abort program flow after a redirect?

Displaying 20 results from an estimated 7000 matches similar to: "How to abort program flow after a redirect?"

2005 Dec 20
7
wrong id for activerecord object when using :joins in mysql
I''m using a find with a :joins clause, like this: :joins => "JOIN table_b ON table_b.id=table_b_id" The records returned are used in a scaffold generated list page. The edit, show, and destroy links are getting the wrong id. They are getting the id of the table b record. When I run the query using mysql, I see that the query returns *2* id columns, the id of the main
2006 Mar 01
5
validations without AR - going crazy trying to find link
Hi, in the past few months someone posted an entry on their blog about how to do validations in non-AR classes and I cant find it any more. Anyone have a link? Thanks, Trevor -- Trevor Squires http://somethinglearned.com
2005 Dec 23
6
Agile book - test error
Hi all, I get an error when testing the "store_controller_test.rb" The troublesome line is in the test below: def test_add_to_cart get :add_to_cart, :id => @version_control_book.id <<< cart = session[:cart] assert_equal @version_control_book.price, cart.total_price assert_redirected_to :action => ''display_cart'' follow_redirect
2006 Mar 20
2
Rails Plugin to Help Debug Views
Hi, I just released a plugin to help debug views. The plugin makes it easy to add a button that will popup a new window that displays the following debug data; * Request Parameters * Session Variables * Flash Variables * Assigned Template Variables It was derived from code that traces back to Marten Veldthuis in Epilog. You can check out webpage and plugin via;
2006 Jan 19
2
Easy way to handle form input without a model class?
I have a couple forms that I''d like to be able to validate and automatically populate, but it shouldn''t be based on AR. In fact I often have a bunch of small forms that I can''t really justify writing a whole new model class for anyway. I''d like to validate the form input, and then use rails helpers to automatically populate the form if validations fail.
2005 Dec 19
2
Advanced search/filter use cases
I''ve been working on an application lately that has a lot of advanced search and filtering functionality (with ranges and substring searches for each attribute). Despite being a pretty common use case, this isn''t supported particularly well by any framework I''ve used, including Rails. I''d like to fix that. :) Right now, my major pet peeves are: 1. Long,
2006 Mar 02
1
Forms with and without Models and Error Handling
Hi, I currently programming a delicious clone to understand ruby on rails. The problem I''ve got is that I prefill a form (form without models) without a database connection and then save it into the database. For validation i am using the validation helper methods. My Problem is that i don''t know how I get the error hash from the helper method validates... etc. because I
2005 Dec 22
1
[NEWB] How to access database.yml parameters in a controller
Hi, Are the active database.yaml attributes for the current environment (dev, prod, test) available inside a controler ? adapter, host, db, socks, etc. AFIK Class#connection don''t give back theses infos. Thanks
2005 Dec 22
2
routes and url_for
Hi, All. I try to relocate controllers. Admin space controlers moved to /app/controllers/admin and user space controllers to /app/controllers/user In routes.rb I use map.connect ''search'', :controller => ''user/search'' that correct I see. But when I want to use start_form_tag or simply url_for, that used in start_form_tag, I do not know how generate url
2005 Dec 30
1
Need serious help - unit testing without a database
I''ve created a model, let''s just call it Person class Person attr_accessor :first_name, :lastname def full_name @first_name + " " + @last_name end end I''m using this in my Rails application. My Rails application does not use a database of any kind, and this model is obviously not a subclass of ActiveRecord::Base. I can''t unit test this
2006 Mar 03
3
dynamic queries
Is there an easy (and secure) way to search your database when you don''t know the number of parameters ahead of time? I can see doing it by concatenating together an sql query, but hopefully rails provides a more elegant way to do this with ActiveRecord without making a ginormous switch statement? For example, lets say my search form has 4 different input boxes. I only want the query
2005 Dec 21
13
Too many login generators?
there is a blog about it http://www.realityforge.org/articles/2005/11/12/aaa_in_rails There are so many Authentication/Authorization/Auditing generators now, just like the situation in java''s world, Too many components doing the samething just make me confusion. Why not add one to rails core lib and everybody can extend it for their requirement ? -- Posted via
2007 Sep 27
1
rspec_on_rails: controller method not getting called
In my rspec_on_rails controlle rspec, I have this: require File.dirname(__FILE__) + ''/../spec_helper'' describe FooController, "with a foo" do it "should be false" do get ''index'' assigns[:foo].should be_false end end In my controller I have this: class FooController < ApplicationController def index @foo = FALSE end
2005 Aug 17
53
Everyone wants a RoR framework
It seems like everyone now has a RoR type framework: Perl: http://dev.catalyst.perl.org/ PHP: http://cakephp.org/ Python: http://www.django.com ASP.NET: http://www.castleproject.org/index.php/Main_Page etc., etc. Has a revolution begun with the birth of these "Web 2.0" frameworks? Its going to be interesting when the tech media begins its mass hype like it did SOAP, XML, etc. a
2005 Dec 16
4
Validation with Aggregation
ActiveRecord supports composed_of for value objects which is fantastic but one thing that it doesn''t seem to support (or at least I am unable to find any documentation for) validation of the value objects. For example, given the following: class Message < ActiveRecord::Base composed_of :sender, :class_name => ''EmailAddress'' composed_of :recipient,
2006 Apr 29
1
reloading include-modules inside controller not working
Hi guys, I would expect an ActionController-derived class to reload _completely_ in development mode. class FooController < ApplicationController include FancyStuffSupport def index # bla end # more actions here end However, the ''FancyStuffSupport'' is not reloaded, only the ''FooController'' itself. Can this behaviour be changed? I feel back
2008 Nov 13
3
metaprogramming with lm
Hello, Say I want to make a multiple regression model with the following expression: lm(y~x1 + x2 + x3 + ... + x_n,data=mydata) It gets boring to type in the whole independent variables, in this case x_i. Is there any simple way to do the metaprogramming for this? (There are different cases where the names of the independent variables might sometimes have apparent patterns or not)
2008 Apr 29
1
Spec''ing controller macros
Hi, (This is my first post after months of appreciative lurking...) I''m trying to spec the following conditional controller macro: class ApplicationController < ActionController::Base # turn off session management for robots session :off, :if => lambda {|req| req.user_agent =~ /(Google|Slurp)/i } # ... end My current attempt seems to be quite unsuccessful: 1) when I
2006 Jan 30
3
ActiveRecord without database
The question is this. Can I use ActiveRecord without the presence of a database? I use only YAML file for my project and I would like use the power of ActiveRecord for my models. I have not tested and so I ask you if this is possible. Thanks so much. --Reis -- Posted via http://www.ruby-forum.com/.
2011 Jul 16
2
[LLVMdev] select1st, select2nd
Chris Lattner <clattner at apple.com> writes: > The problem that I have with this sort of higher order metaprogramming Metaprogramming? This isn't template metaprogramming if that's what you mean. > in C++'98 is that you're trading one set of complexity for another. What's the other complexity? -Dave