similar to: Finding a nested resource's 'parent' object?

Displaying 20 results from an estimated 1000 matches similar to: "Finding a nested resource's 'parent' object?"

2006 Apr 27
3
Removing a default value for a foreign key with not null set
Hi all, For various reasons I need to have foreign keys with not null constraints. Eg: create_table :people do |t| t.column :name, :string t.column :household_id, :integer, :null => false end create_table :households do |t| t.column :name, :string end add_foreign_key_constraint :people, :household_id, :households, :id So the people table has a foreign key into
2008 Aug 27
11
find_by_sql and xml_serializer problems
Hi, I''m doing a find_by_sql and am getting an odd error when trying to render the result to xml. The find is: children_list = find_by_sql("SELECT components.componentid, components.logicalname, versions.level, versions.branch, versions.sequence FROM components, versions where components.componentid = ''" + component_id + "''" + " AND
2007 Feb 10
3
recognize_path discrepency
hey all - wondering if someone would relive my confusion... given a model called say Meeting and a route as "map.resources :meetings" in the console: >>r=ActionController::Routing::Routes >>r.recognize_paths "/meetings" =>{:action="index",:controller=>"meetings"} all works as I expect, but if I do >>r.recognize_paths
2007 Nov 16
3
Route Information
Is there a method to return a hash of the route configuration based on a path? For example: magic_method(''/my_controller/my_action/my_id'') => {:controller => ''my_controller'', :action => ''my_action'', :id => ''my_id''} Thanks! Tom --~--~---------~--~----~------------~-------~--~----~ You received this message
2007 Oct 03
3
manually invoking routing?
Hey folks. I have a rails controller which is filtering search results for access control. The search results are typically URLs into the rest of the rails app. I''m finding it would simplify the grotty code which is accumulating if I could manually invoke the router. That is to say, if I could send something a URI path string and get back the hash of controller, action, and params that
2011 Jun 22
3
Status of Rails.application.routes.recognize_path()
Sorry if this question isn''t really "Ruby on Rails: Core" material. I feel it is, at least kind-of (also, I first tried asking in "Ruby on Rails: Talk" to no avail.). So, while writing a gem (engine) for rails, I found that I needed to have my app (in a pre-filter) directly query the router. In the "old" days, this was done using
2009 May 01
4
Can't get to an action in a RESTful controller
Folks, I am using the restful_authentication plugin. This creates the users controller which is declared as a resource in routes.rb as below map.resources :users Now in the UsersController I have created an action to resetpwd that I am trying to get to from the login page when the user clicks "forgot password". However, when I do that the log file tells me that the call to
2006 May 31
2
ActiveRecord and database metadata. How much can I get?
All, I have need of getting at some underlying database metadata for ActiveRecord descendants. Does anyone know if I can get access to the following attributes of the underlying column for a given ActiveRecord object: Is it a currency object? Is it nullable? Is it a signed int? Is it searchable? Column length Column name Column precision Column scale Column data type - how specific can I get
2005 Dec 30
3
Too many columns for list.rhtml to display on one page
I''ve gone once through the Agile book and am now attempting my own rails app. I''ve created a table named ''volunteers'' with over 15 columns. The problem is the default list.rhtml that is created with the scaffold, shows all the columns. I only want to show 4 of them with the list view. Where would I start to only return a handfull of columns to the
2007 Aug 25
4
REST routes :has_many , new style
I am trying to write a nested route ''new style'' map.resources :franchises, :has_many => :documents in place of the : map.resources :franchises do |franchises| franchises.resources :documents, :name_prefix => "franchise_" end but get an error : no route found to match "/franchises/1/documents" with {:method=>:get} running rake routes,
2014 Jul 29
4
[PATCH 0/2] supermin: improve handling of memory
Hi, the two patches improve the way memory is handled in supermin, by cleanly exiting on memory allocation failures, and free'ing memory when not needed (to keep working and not run out of memory). Pino Toscano (2): Check for failures in memory allocations Free memory buffers when not used src/ext2fs-c.c | 13 +++++++++++-- src/init.c | 13 +++++++++++++ 2 files changed, 24
2008 Mar 03
2
how can i know type of attribute with active record
Hello, In my database, I have a table "products" with attributes : - id - title ->string - desc -> text I use active record, but I don''t know why recover the type of this attribute with active record? I try attributes_before_type_cast but I don''t see the type Can you help me? Excuse for my english (I''am a young student french) -- Posted via
2024 Apr 13
1
any and all
Hi Avi, As D?nes T?th has rightly diagnosed, you are building an "all or nothing" filter. However, you do not need to explicitly spell out all columns that you want to filter for; the "tidy" way would be to use a helper function like `if_all()` or `if_any()`. Consider this example (I hope I understand your intentions correctly): ``` library(dplyr) data <- tribble(
2006 Jul 20
5
Why don''t I get 404s?
When I go to a missing page in my rails app, I get the 500.html page, and this in my log output: no route found to match "/asdasd" with {:method=>:get} ./script/../config/../vendor/rails/actionpack/lib/action_controller/ routing.rb:1057:in `recognize_path'' ./script/../config/../vendor/rails/actionpack/lib/action_controller/ routing.rb:1047:in `recognize''
2003 Aug 24
2
wxRuby 0.1.0 Alpha has been released!
http://rubyforge.org/project/showfiles.php?group_id=35&release_id=46 The code itself has been quite stable for several weeks. This release includes Gour''s excellent MinGW README notes, along with various updates to the README, and clarification of the LICENSE. Thanks to everyone for your help in putting this together. It was definitely a team project. I look forward to getting lots
2009 Mar 06
2
Routes.recognize_path on more complicated Routes
For a permissions system i''m writing i''m extending the standard link_to helpers to check if a user has a permission to perform that action before displaying a link to clean-up my code so i don''t have to put if checks all over them. I''m trying to use.. ActionController::Routing::Routes.recognize_path(url, :method => method) to get the action and controller
2009 Nov 10
10
Un-recognised routes that do exist, using namespaces & subdomain checking
I''m getting really cheesed off with RSpec not matching some of my routes when controller testing when I have subdomain checking (courtesy of subdomain-fu) on namespaces. These routes appear in the rake routes output, and work fine via HTTP requests . The really annoying thing is it''s working fine for routes that aren''t at the root of the namespace. E.g. say I have
2007 Sep 16
2
Problem with recognize_path
Hello, I am experiencing a weird problem on one of the 3 test servers I''m using: There is a controller named admin/statistics and I am trying to access /admin/statistics The matching rule is: map.connect '':controller/:action/:id'' On 2 of the 3 servers, recognize_path correctly matches to Parameters: {"action"=>"index",
2006 Apr 03
3
[newbi] Problem Routes
Hello, i try to follow this video http://www.illanti.com/files/locomotive101.mov After change my routes routes.db ActionController::Routing::Routes.draw do |map| # Add your own custom routes here. # The priority is based upon order of creation: first created -> highest priority. # Here''s a sample route: # map.connect ''products/:id'', :controller =>
2024 Apr 12
2
any and all
Base R has generic functions called any() and all() that I am having trouble using. It works fine when I play with it in a base R context as in: > all(any(TRUE, TRUE), any(TRUE, FALSE)) [1] TRUE > all(any(TRUE, TRUE), any(FALSE, FALSE)) [1] FALSE But in a tidyverse/dplyr environment, it returns wrong answers. Consider this example. I have data I have joined together with pairs of