Re: [Rails] Re: Complex abilities and scoping of records

2013-02-21 Thread Tim Uckun
On Fri, Feb 22, 2013 at 3:51 AM, javinto jan.javi...@gmail.com wrote: Have you been looking at CanCan? I've implemented a similar situation with CanCan. It will not cover your needs for 100% but it will do a lot. Yes I have been looking at cancan. I have also been looking at Consul. Of the

[Rails] Complex abilities and scoping of records

2013-02-20 Thread Tim Uckun
I have the following scenario. Users have various levels of ability. They can only view and edit their own records (their profile). Their managers can only view and edit their employees records. The regional managers can view and edit only the people in their regions and the corporate

Re: [Rails] Postgres COPY from STDIN

2012-03-21 Thread Tim Uckun
conn = ActiveRecord::Base.connection_pool.checkout raw  = conn.raw_connection raw.exec(COPY tablename (col1, col2, col3) FROM STDIN) # open up your CSV file looping through line by line and getting the line into a format suitable for pg's COPY... rc.put_copy_data line # once all done...

[Rails] Postgres COPY from STDIN

2012-03-20 Thread Tim Uckun
I have done some googling to try and figure out how I can use COPY FROM STDIN with rails and have ran into some posts on stackoverflow or the mailing list but none of them seem to be working with rails 3.2 Does anybody have a working example of using COPY FROM STDIN? Some things I have tried

Re: [Rails] Ubuntu: Best IDE

2011-11-17 Thread Tim Uckun
Rubymine. Has full support for git (and everything else you can think of) On Fri, Nov 18, 2011 at 3:17 PM, Mathew S. li...@ruby-forum.com wrote: Anything but Aptana Studio I have not had good luck with Aptana... So Please give me a list of your favs. And how you would open up the

Re: [Rails] Rails 3.1 and minitest

2011-11-17 Thread Tim Uckun
I'll bump this. I too am interested in getting minitest working especially with autotest. I kind of got something going but it's ugly and doesn't work with autotest. On Thu, Oct 20, 2011 at 12:37 PM, djangst djan...@gmail.com wrote: I'm looking for a simple way to integrate minitest/spec with

[Rails] matching each subdomain to a different controller.

2011-08-17 Thread Tim Uckun
I want to create routes that map a subdomain to a controller. Each controller will have the same actions but they will have different views and will do different things. So basically I want something like this imaginary route constraints(app = App.new) do controller app.controller do

[Rails] using bundler while developing a gem.

2011-08-07 Thread Tim Uckun
I want to be able to specify something like this. group :development do gem 'mygem', :path = File.expand_path(File.dirname(__FILE__) + '/../mygem') end group :production do gem 'bingatron-core', :git = g...@github.com:myaccount/mygem.git end Bundler doesn't like this at all and complains

Re: [Rails] Re: postgres default values don't work with active record

2011-08-05 Thread Tim Uckun
I don't think so - I think activerecord is expecting to be able to read the default values out of the database schema, although that assumes that the default is some fixed value. It should be possible to do something like this though, since updates only write unchanged columns. In postgres

Re: [Rails] Re: TypeError: can't convert nil into Integer

2011-05-12 Thread Tim Uckun
Having a column called hash is weird - Object has a method called hash, which your attribute will shadow, which could mess up trying to call uniq on an array containing objects of your class Fred That was the case. Can't have a column called hash in your models. You trip on the magic. --

[Rails] TypeError: can't convert nil into Integer

2011-05-11 Thread Tim Uckun
I am getting this error with a very simple model and schema. The record saves even though an error has been generated. I have tried this with both postgres and mysql. Here is the model. class Person ActiveRecord::Base end Here is a transcript.. p = Person.new = #Person id: nil, hash: nil,

[Rails] Incomplete multibyte character when using postgres

2011-04-26 Thread Tim Uckun
Has anybody ran into this error with rails and postgres? I get this quite a bit and I have no idea why. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe

[Rails] Forking to save memory when using REE.

2011-04-24 Thread Tim Uckun
I have a few dozen daemons and all of them load the rails environment. Each one uses the DaemonSpawn gem to daemonize itself. I was thinking that I could save a lot of memory if I could somehow share the rails environment between all of these daemons. It seems to me the simplest thing to do

[Rails] Pentaho

2011-03-24 Thread Tim Uckun
I did a quick search for pentaho on the mailing list and a post came up from 2008. Has anybody integrated pentaho with rails yet? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to

Re: [Rails] Weird form behavior

2011-02-11 Thread Tim Uckun
On Fri, Feb 11, 2011 at 4:40 PM, Tim Uckun timuc...@gmail.com wrote: On Fri, Feb 11, 2011 at 4:38 PM, Jim Ruther Nill jvn...@gmail.com wrote: I'm not sure but if you look at http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html your params does not have the same

[Rails] Weird form behavior

2011-02-10 Thread Tim Uckun
I am having a confounding issue and I hoping somebody can give me a clue as to what is happening. I have one field in my table which is not updating via the form. It updates fine if I extract the information from the params and do it manually in the controller. On this form the ebmedded form is

Re: [Rails] Weird form behavior

2011-02-10 Thread Tim Uckun
On Fri, Feb 11, 2011 at 4:07 PM, Jim Ruther Nill jvn...@gmail.com wrote: i don't know if location is a special term or not. But I have a question, do have an attr_accessible line in your user model? If you do, check that you have the location attribute listed there. DOH!. Yes that was the

Re: [Rails] Weird form behavior

2011-02-10 Thread Tim Uckun
On Fri, Feb 11, 2011 at 4:38 PM, Jim Ruther Nill jvn...@gmail.com wrote: I'm not sure but if you look at http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html your params does not have the same format as the one stated in the link.  It should be

[Rails] Making destroy_all work faster.

2011-01-19 Thread Tim Uckun
When I call destoy_all on a model with a where clause AR iterates though each record in the recordset and calls destroy on each item. This seems highly inefficient to me. Wouldn't it be better to call delete from child records where foreign_id in (parent ids)? In other words shouldn't destroy all

Re: [Rails] Making destroy_all work faster.

2011-01-19 Thread Tim Uckun
No.  Destroy has to instantiate each object prior to actually removing it from the database in order to run any before/after destroy call backs. You can speed things up if you don't need this by tweaking the :dependent option to has_many so that it will simply use SQL's DELETE on the child

Re: [Rails] Re: Having problems with rails connectivity to postgres (libpq?)

2010-12-19 Thread Tim Uckun
On Sun, Dec 19, 2010 at 7:26 PM, Jim Morris wolfma...@gmail.com wrote: I've spent the day trying to track this down. I am not seeing it with my older rails/activerecord app, only with the newer rails 3.0.3/ sequel app. I am seeing it using activerecord on rails 3.0.3 The problem just occured

Re: [Rails] Re: Having problems with rails connectivity to postgres (libpq?)

2010-12-19 Thread Tim Uckun
I suspect what is happening in my case, (and maybe yours), is the SSL connection is renegotiating and failing, which is documented elsewhere (google postgresql ssl renogotiation) So far I have not seen this issue since I switched to a local connection. Although I have two other older rails

Re: [Rails] Re: Having problems with rails connectivity to postgres (libpq?)

2010-12-18 Thread Tim Uckun
On Sat, Dec 18, 2010 at 11:05 AM, Jim Morris wolfma...@gmail.com wrote: I have recently deployed a similar setup, Ubuntu 10.04, pgsql 8.4, rails 3.0.3, pg gem etc. I have started to see this error occasionally, that request fails then subsequent requests are OK, the pgsql log says the client

[Rails] Having problems with rails connectivity to postgres (libpq?)

2010-12-17 Thread Tim Uckun
I have some daemons that connect to a PG database and are pretty busy. Every few days at least one of them starts failing with this error. PGError: lost synchronization with server: got message type something Sometimes the message type is an empty string. Other times it's a letter like E or

[Rails] Re: Getting postgres connection errors

2010-11-03 Thread Tim Uckun
This problem started with the recent update to rails. I also think it may have to do with this statement ActiveRecord::Base.connection_pool.clear_stale_cached_connections! The postgres mailing list tells me these errors have to do with threading in libpq. On Wed, Nov 3, 2010 at 11:41 AM, Tim

[Rails] Getting postgres connection errors

2010-11-02 Thread Tim Uckun
I am getting these types of errors quite frequently and am wondering what may be causing them or how to fix them. PGError: lost synchronization with server: got message type T, length 1409286191 PGError: lost synchronization with server: got message type T, length 1409286191 PGError: lost

Re: [Rails] Re: Sharing sessions between a rails3 app and a rails2 app. Rails 2 app crashes.

2010-08-24 Thread Tim Uckun
Well it looks like the core issue is that HashWithIndifferentAccess became ActiveSupport::HashWithIndifferentAccess in rails 3. The session is a serialized ruby object which somewhere is saying that it contains an instance of class ActiveSupport::HashWithIndifferentAccess and rails 2 is

Re: [Rails] Re: Sharing sessions between a rails3 app and a rails2 app. Rails 2 app crashes.

2010-08-24 Thread Tim Uckun
I'll give that a try and see if it works. Another thing I noticed was that rails3 sets a 'session_id' and rails2 sets a :session_id Just to follow up on this... Your workaround worked but it only went so far. Now I am getting this error. Session contains objects whose class definition

Re: [Rails] Re: Sharing sessions between a rails3 app and a rails2 app. Rails 2 app crashes.

2010-08-23 Thread Tim Uckun
On Tue, Aug 24, 2010 at 7:04 AM, gkaykck gkay...@gmail.com wrote: you should share some code here, there could be many reasons for that Ok it's pretty simple. In rails 2 app I have something like this. Initializers session_store.rb ActionController::Base.session_store = :cookie_store

[Rails] Sharing sessions between a rails3 app and a rails2 app. Rails 2 app crashes.

2010-08-22 Thread Tim Uckun
Hey all. I have two apps. One is a rails3 app and the other is a rails 2 app. Using proxying I am routing actions in the myapp.com/foo to the rails2 app. It almost works! I can set a session variable and a cookie variable on the first app (myapp.com) and then read them on the second app

[Rails] Hash.from_xml does not handle attributes as of rails3 beta4

2010-08-11 Thread Tim Uckun
Can anybody confirm whether or not this has been fixed in the rc releases? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email

[Rails] curl works when testing JSON response but the functional and integration tests do not work.

2010-08-02 Thread Tim Uckun
I am trying to test an action which is supposed to give a json response The url goes something line /blah/model.json When I POST to that URL using curl like this curl -H Content-Type:application/json -H Accept:appn/json-d data http://localhost:3000/blah/model.json it works just fine. In

[Rails] How to determine the running controller in rails3

2010-07-28 Thread Tim Uckun
The @controller and @template are returning nil in rails3. What is the proper way to refer to the current controller in rails3? Cheers. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to

Re: [Rails] hi - a favour required immediately

2010-04-09 Thread Tim Uckun
On Sat, Apr 10, 2010 at 4:48 AM, Julian Leviston jul...@coretech.net.au wrote: http://code.google.com/webtoolkit/ It would be kind of cool if there was a version of this for ruby or jruby. Just as an alternative to rails. -- You received this message because you are subscribed to the Google

[Rails] Re: Testing and SQL views.

2009-04-20 Thread Tim Uckun
The only code I can see that affects triggers is in the original PostgreSQLAdapter#disable_referential_integrity method. It disables triggers during a block and re-enables them afterwards. As far as I remember, this is used to load fixtures while temporarily suspending the triggers. As

[Rails] Re: Testing and SQL views.

2009-04-19 Thread Tim Uckun
http://github.com/aeden/rails_sql_views/tree/master and my heavily hacked version http://github.com/mschuerig/rails_sql_views/tree/master My version works with Rails 2.3.2, loads only the adapters that are really needed, and adds ActiveRecord::View as an abstract superclass for views

[Rails] A bug in sweeper.rb? [was: A frustrating and strange error when config.action_controller.perform_caching = true]

2009-04-18 Thread Tim Uckun
I fired up the debugger and watched the code happen tonight. The problem occurs if the config.action_controller.perform_caching = true in your environment. It's not set to true in development but it is set to true in production and staging. The problem occurs not in my controllers but in

[Rails] Re: Testing and SQL views.

2009-04-17 Thread Tim Uckun
Name the fixtures.yml file after the actual target table, not the view. I'll give that a shot. Thanks... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send

[Rails] A frustrating and strange error when config.action_controller.perform_caching = true

2009-04-17 Thread Tim Uckun
Hello all. I am having a hell of a problem and it's driving me nuts. I get the following error (undefined method `controller_name' for nil:NilClass): but only when config.action_controller.perform_caching = true I googled around some and found this thread

[Rails] Re: Testing and SQL views.

2009-04-17 Thread Tim Uckun
On Sat, Apr 18, 2009 at 12:43 AM, Harold A. Giménez Ch. harold.gime...@gmail.com wrote: What DBMS are you using? The alternative is a materialized view. postgres. Name the fixtures.yml file after the actual target table, not the view. I'll give that a shot. Thanks... This didn't

[Rails] Re: Testing and SQL views.

2009-04-17 Thread Tim Uckun
Have a look at http://github.com/aeden/rails_sql_views/tree/master and my heavily hacked version I looked at this. It didn't work in my setup. http://github.com/mschuerig/rails_sql_views/tree/master My version works with Rails 2.3.2, loads only the adapters that are really needed,

[Rails] Testing and SQL views.

2009-04-16 Thread Tim Uckun
The tests want to execute delete * from TABLENAME and this causes problems when the table is actually a view. Is there an easy way to deal with this issue? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on

[Rails] Neither from_xml nor from_Json work in rails 2.1

2008-11-27 Thread Tim Uckun
If you have the need to do a lot of XML processing you are better off staying away from rails completely. The State of SOAP on rails is a mess to the point of being practically unusable. The XML and json deserialization is like playing russian roulette with five bullets in the chamber. Try

[Rails] Re: Neither from_xml nor from_Json work in rails 2.1

2008-11-27 Thread Tim Uckun
Minus your mysterious 'change the xml' that worked for me.If you could produce a more precise example (or at least elaborate on Doesn't work (raises an exception, does nothing, has the wrong attributes, something else...) you might get a more helpful response. Let's see. u =

[Rails] Re: Neither from_xml nor from_Json work in rails 2.1

2008-11-27 Thread Tim Uckun
Is timezone a protected attribute (as in attr_protected or not on the list given to attr_accessible) ? No. It's changeable by the web GUI too. Also if that was the case you'd expect the validation to throw up an error right? Is the accessor function timezone= overwridden ? Does it work if

[Rails] Re: Actionwebservice as a SOAP client to .NET services.

2008-11-24 Thread Tim Uckun
You probably want SOAP4R. See http://rubyforge.org/projects/soap4r/ and also my tutorial at http://markthomas.org/2007/09/12/getting-started-with-soap4r Thanks. I have written a stand alone ruby script that fetches the data I want. The next step is to see if I can make it work in rails.

[Rails] Re: Handling multiple domain accounts for accessing a single web app.

2008-11-06 Thread Tim Uckun
account_location plugin, then use account_domain and use it as a key in your access management. Different templates, same functionality: either switch the stylesheet (CSS) or go un-DRY by using different view folders for each domain. The account_location plugin talks about subdomains. Do

[Rails] Re: Handling multiple domain accounts for accessing a single web app.

2008-11-02 Thread Tim Uckun
On Thu, Jul 3, 2008 at 6:24 PM, jacob v thomas [EMAIL PROTECTED] wrote: hi all, Here is the question, Is there a way to set multiple domain name for accessing a single rails application, Bump. Is there a way to handle multiple domains including being able to use different templates for

[Rails] Re: Postgres adapter issues with Rails 2.1: ruby-pg is the answer!

2008-10-19 Thread Tim Uckun
-- Building native extensions. This could take a while... ERROR: Error installing ruby-pg: ERROR: Failed to build gem native extension. I had the same problem. I have some additional questions. Why is the official postgres gem for rails ruby-pr when it doesn't work on windows at