[Rails] Re: ActiveResource does not detect errors for my very simple model

2010-04-28 Thread Thomas Allen
I referred to http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/67d59a432f1d98e3 and tried this with Rails 2.2.2, but got the same result. I am guessing the issue I am experiencing is not version-specific. Thomas On Apr 28, 12:16 pm, Thomas Allen wrote: > The documentat

[Rails] ActiveResource does not detect errors for my very simple model

2010-04-28 Thread Thomas Allen
The documentation says to return a code 422 with a packet in the following format: First cannot be empty So that is what I am doing. But my model will not raise an exception on a create call that returns such a response, and a record created that way returns true for its valid? call. I simply do

Re: [Rails] Model controlled by API calls

2010-04-22 Thread Thomas Allen
It looks like ActiveResource is what I wanted. Thoma Thomas Allen wrote: > Hello, > > I was wondering if anybody knew of a library (acts_as_ or similar) > that provides a simple framework for mapping ActiveRecord calls to API > calls for model instances that are

[Rails] Model controlled by API calls

2010-04-22 Thread Thomas Allen
Hello, I was wondering if anybody knew of a library (acts_as_ or similar) that provides a simple framework for mapping ActiveRecord calls to API calls for model instances that are managed via API calls rather than a database connection. Thomas -- You received this message because you are subscr

[Rails] Re: Accessing the router from a helper

2010-04-21 Thread Thomas Allen
homas On Apr 21, 5:07 pm, Michael Pavling wrote: > On 21 April 2010 22:00, Thomas Allen wrote: > > > On Apr 21, 4:37 pm, Michael Pavling wrote: > >> On 21 April 2010 20:36, Thomas Allen wrote: > > >> >    active = request.request_uri == url > > >>

[Rails] Re: Accessing the router from a helper

2010-04-21 Thread Thomas Allen
On Apr 21, 4:37 pm, Michael Pavling wrote: > On 21 April 2010 20:36, Thomas Allen wrote: > > >active = request.request_uri == url > > Would using url_for() not save you a lot of hassle generating that url? Thanks Michael, url_for was what I was looking for in place of man

[Rails] Accessing the router from a helper

2010-04-21 Thread Thomas Allen
I find manually accessing the router to be quite ugly below. Is there a more direct way to access it? module ApplicationHelper def menu_item text, url = nil routes = ActionController::Routing::Routes url = if url if url.is_a? String url else

[Rails] Flattening 1:1 models

2010-04-21 Thread Thomas Allen
Is there a simple way to flatten 1:1 models so that the methods in one are accessible from another? This attempt results in a stack depth exception for any call to one of the explicitly defined methods: class User < ActiveRecord::Base has_one :contact Contact.column_names.each do |col| d

[Rails] Re: A way to build

2010-04-21 Thread Thomas Allen
Thanks, that seems to be the right idea. Here's what I ultimately settled on...the following results in "Home | Dashboard | PNC" for a request to DashboardController#index. class ApplicationController < ActionController::Base def self.title item before_filter do |controller| controlle

[Rails] A way to build

2010-04-20 Thread Thomas Allen
I would like to be able to easily build a string. Here is how I am doing it right now (I have omitted parts not relevant): In the layout: <%= title %> Which calls: module ApplicationHelper def title @title_parts.join ' | ' end end and @title_parts is build like so: class Ap

[Rails] Gem::FilePermissionError on "rails:freeze:gems" task

2010-04-19 Thread Thomas Allen
My understanding is that the "rails:freeze:gems" task copies the Rails source into the application's vendor directory. Which is why I find the following error surprising and confusing, because the task should not involve writing to system files or directories: % rake rails:freeze:gems (in /Users/t

[Rails] Testing mail server connection?

2010-04-16 Thread Thomas Allen
Does anybody know of a way to test that the configured mail server connection works? In a similar vein, is there a way to simply test the database connection? I use db:migrate for that now but I'd prefer a method that simply verifies the connection settings. Thomas -- You received this message b

[Rails] Is there a way to override SQL generated during rake:test:clone_structure?

2009-09-01 Thread Thomas Allen
I have two tables with ID columns that must be unsigned integers. When I try to clone the database for testing, Rails misjudges these columns as signed integers, and the test cannot proceed because this table type does not accept a signed integer for these columns (Sphinx SE document and body tabl

[Rails] Re: rake db:test:clone_structure and related tasks fail

2009-08-28 Thread Thomas Allen
It appears that this is coming from my installed lib/mysql_adapter.rb which has an incorrect signature for recreate_database (and probably for other methods as well), so I think I have what I need to solve the problem now. Thomas On Aug 28, 9:50 am, Thomas Allen wrote: > On Aug 28, 3:23

[Rails] Re: rake db:test:clone_structure and related tasks fail

2009-08-28 Thread Thomas Allen
On Aug 28, 3:23 am, Nik Cool wrote: > > rake aborted! > > wrong number of arguments (2 for 1) > > /usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake: > > 344:in `recreate_database' > > > Thanks! > > Thomas > > do you have test database created ? > -- > Posted viahttp://www.rub

[Rails] rake db:test:clone_structure and related tasks fail

2009-08-27 Thread Thomas Allen
Judging by the exception's location, the test environment config is not getting loaded. Do I need to do something else to activate this environment? 341 case abcs["test"]["adapter"] 342when "mysql" 343 ActiveRecord::Base.establish_connection(:test) 344 ActiveRecord:

[Rails] Re: AJAX "render :partial" does not update if specified view matches current view

2009-07-22 Thread Thomas Allen
Hm, I'll try explicitly setting the [nonstandard] autocomplete attribute off in the inputs... Thomas On Jul 22, 9:02 am, Frederick Cheung wrote: > On Jul 22, 1:51 pm, Thomas Allen wrote:> Is what I'm > attempting possible with render :partial? > > Have you checked wi

[Rails] Re: AJAX "render :partial" does not update if specified view matches current view

2009-07-22 Thread Thomas Allen
Is what I'm attempting possible with render :partial? On Jul 20, 3:55 pm, Thomas Allen wrote: > I have some simple code that renders a form to an element specified in > form_remote_tag :update. The problem is that, if the loaded view > matches the view to render, Rails does nothi

[Rails] AJAX "render :partial" does not update if specified view matches current view

2009-07-20 Thread Thomas Allen
I have some simple code that renders a form to an element specified in form_remote_tag :update. The problem is that, if the loaded view matches the view to render, Rails does nothing rather than refreshing the view (which is the desired behavior). There is an element with id "form," also specifie