[Rails] Should rails force asset caching in development?

2016-04-06 Thread Tony Primerano
When working in development mode (using webrick) it is painful waiting for pages to load when there are a lot of css and js assets that are loaded one by one. This has annoyed me for years but today it dawned on me how easy the fix is. I'm using Rails 4.1.x in development.rb Add the digest

[Rails] Should capistrano be in my Gemfile?

2012-03-16 Thread Tony Primerano
Currently I have capistrano in my Gemfile and when I deploy I do bundle exec cap deploy I run several rails apps on a single server and their Gemfiles may differ over time resulting in several installs of capistrano. I'm wondering if I should just leave capistrano out of the gemfile and install

[Rails] Re: New date format in gemspec breaks older rubygems version

2011-10-04 Thread Tony Primerano
/ead8ec8d57331b6b750d1622e5b683763b92fd73#diff-1 The ticket https://github.com/mpapis/rubygems-bundler/issues/6 On Sep 20, 1:00 pm, Tony Primerano tony.primer...@gmail.com wrote: I forget why but I'm stuck using rubygems 1.7.2, which means I occasionally get the dreaded invalid date format

[Rails] New date format in gemspec breaks older rubygems version

2011-09-20 Thread Tony Primerano
I forget why but I'm stuck using rubygems 1.7.2, which means I occasionally get the dreaded invalid date format in specification error message What sets the date format? For example. with rubygems-bundler Invalid gemspec in [/usr/local/rvm/rubies/ree-1.8.7-2011.03/lib/ruby/

[Rails] rake doc:app uses deprecated options (invalid options: --line-numbers, --inline-source)

2011-05-04 Thread Tony Primerano
I'm using Rails 3.0.7 / Ruby 1.9.2 and I'm wondering what the recommended way to generate app docs is. Running rake doc:app generates good documentation but click to toggle source doesn't work since rdoc 2.5.8 doesn't support the '-- line-numbers, --inline-source options that the rake task

[Rails] Upgrading from mysql to mysql2 breaks UTF-8

2011-04-13 Thread Tony Primerano
For some reason I didn't start using mysql2 until recently on my Rails3/1.9.2 project and I just noticed that this change caused some of my data to display incorrectly. I guess the mysql gem doesn't really store data in UTF-8 so I wrote a migration to fix the broken items. My question is, do I

[Rails] optional form :remote ?

2011-03-17 Thread Tony Primerano
Is it possible to have a form submit normally if button X is pushed and do an AJAX call if button Y is pushed? My use case: I'm letting users do some customizations and I want a preview button and a save button. Hitting preview submits the current form values as an AJAX call and the returned

[Rails] Re: Rails getting started guide: validates not working for me?

2011-03-17 Thread Tony Primerano
The code looks right. Make sure you don't have class Post defined somewhere else (like post.last.rb). Also, make sure you restart the console each time you make changes to the Post class. Don't do a reload on the post class from inside the console as this doesn't work with ActiveRecord last I

[Rails] Re: Why no code completion ?

2011-03-17 Thread Tony Primerano
Use Netbeans. :-) Or find an Aptana help forum ;-) I suspect most people here use textmate, I use netbeans and haven't tried Aptana in over a year On Mar 17, 1:26 pm, hoboy Hoboy li...@ruby-forum.com wrote: I am new to RoR I have installed aptana, eclipse RoR plugin on ubuntu 10.10. but

[Rails] Re: Help with session

2011-03-17 Thread Tony Primerano
does it work when you uncomment this line in destroy? # @cart = current_cart On Mar 17, 4:31 pm, radhames brito rbri...@gmail.com wrote: oookk, so i have 2 actions , create and destroy, i can get session[:cart_id] from inside the create method but not from inside the delete method. def

[Rails] Re: Help with session

2011-03-17 Thread Tony Primerano
oh wait.. ignore that. of course it will work but it just creates a new cart. :-\ sorry, long day On Mar 17, 4:54 pm, Tony Primerano tony.primer...@gmail.com wrote: does it work when you uncomment this line in destroy? # @cart = current_cart On Mar 17, 4:31 pm, radhames brito rbri

[Rails] Re: Help with session

2011-03-17 Thread Tony Primerano
, Tony Primerano tony.primer...@gmail.comwrote: does it work when you uncomment this line in destroy? # @cart = current_cart If i do that what happens is that since the session is nil a new cart i created and i lose all the items in the original current_cart and a new cart is rendered

[Rails] Re: optional form :remote ?

2011-03-17 Thread Tony Primerano
On Mar 17, 4:39 pm, Philip Hallstrom phi...@pjkh.com wrote: Is it possible to have a form submit normally if button X is pushed and do an AJAX call if button Y is pushed? My use case: I'm letting users do some customizations and I want a preview button and a save button.   Hitting

[Rails] Re: Noob Question

2011-03-07 Thread Tony Primerano
yeah, i find the docs fairly hard to navigate and I've been doing this for a while. Once you figure out where the page is http://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html you'll see that none of the methods have any documentation. :-\ There is information on ARel queries

[Rails] default values and text_field

2011-02-11 Thread Tony Primerano
I have a model and I set defaults for some values by overriding the read accessor. For example def heading read_attribute(:heading).nil? ? 'Please select from:' : read_attribute(:heading) end The problem I have found is that text_field ignores this. %= f.text_field :heading % is empty

[Rails] Re: default values and text_field

2011-02-11 Thread Tony Primerano
On Feb 11, 8:45 am, Frederick Cheung frederick.che...@gmail.com wrote: On Feb 11, 1:37 pm, Tony Primerano tony.primer...@gmail.com wrote: I have a model and I set defaults for some values by overriding the read accessor.  For example def heading     read_attribute(:heading).nil

[Rails] Re: default values and text_field

2011-02-11 Thread Tony Primerano
Primerano tony.primer...@gmail.comwrote: On Feb 11, 8:45 am, Frederick Cheung frederick.che...@gmail.com wrote: On Feb 11, 1:37 pm, Tony Primerano tony.primer...@gmail.com wrote: I have a model and I set defaults for some values by overriding the read accessor.  For example

[Rails] Re: HTTP Accept header wildcard breaks rails app

2011-01-10 Thread Tony Primerano
Accept: image/jpg they will get HTML from me. I tried this on some other sites and they returned html even if an image was requested so I am no worse than them :-) On Jan 3, 8:59 am, Tony Primerano tony.primer...@gmail.com wrote: It should be noted that while adding this fixed my test cases

[Rails] Re: recommended HTTP client?

2011-01-06 Thread Tony Primerano
It looks like HTTParty uses Net::HTTP so I'll just stick with that. I got burned by so many deprecated gems moving from Rails 2 to Rails 3 that use them sparingly now. :-\ On Jan 4, 10:53 am, Marnen Laibow-Koser li...@ruby-forum.com wrote: TonyPrimeranowrote in post #972234: In the past I

[Rails] Re: recommended HTTP client?

2011-01-06 Thread Tony Primerano
On Jan 6, 3:04 pm, Marnen Laibow-Koser li...@ruby-forum.com wrote: Please quote when replying. Tony Primerano wrote in post #972913: It looks like HTTParty uses Net::HTTP so I'll just stick with that. Stick with *which*? I'll just call Net::HTTP directly. I have a simple GET request

[Rails] recommended HTTP client?

2011-01-04 Thread Tony Primerano
In the past I have used Net::HTTP to call trivial remote services. These calls have been low frequency so didn't bother looking into alternatives. I'm now looking at a design where I will be calling a remote service that returns a simple CSV but it will be called frequently and if that service

[Rails] Re: HTTP Accept header wildcard breaks rails app

2011-01-03 Thread Tony Primerano
. It seems safe to assume that erb should be used when the Accept header doesn't map to a specific mime-type. Is there a way to make this happen or is there a reason this shouldn't be done? On Dec 31 2010, 6:21 pm, Tony Primerano tony.primer...@gmail.com wrote: well.  adding Mime::Type.register text

[Rails] Treating NULL in DB as false.

2011-01-03 Thread Tony Primerano
I feel like I'm missing something obvious here.. I have a Post object and it has a draft attribute. It may be nil, true or false. I want nil to be treated as false Post.where(:draft = false) does not pick up the posts where draft is unset(nil) This leaves me to query with Post.where('draft

[Rails] Re: Treating NULL in DB as false.

2011-01-03 Thread Tony Primerano
Yeah. I guess ruby is making me lazy. ;-) I'll set all my NULLs to false and validate presence. On Jan 3, 5:42 pm, Scott Ribe scott_r...@killerbytes.com wrote: On Jan 3, 2011, at 3:08 PM, Tony Primerano wrote: Post.where('draft is NOT true') That shouldn't work either. NULL is neither

[Rails] HTTP Accept header wildcard breaks rails app

2010-12-31 Thread Tony Primerano
rails app to treat this as rhtml by default instead of returning a 500? Missing template [controller]/[method] with {:handlers=[:erb, :rjs, :builder, :rhtml, :rxml], :formats=[:text/ *, :js], :locale=[:en, :en]} I'll post a response if I figure it out Tony Primerano -- You received this message

[Rails] Re: HTTP Accept header wildcard breaks rails app

2010-12-31 Thread Tony Primerano
of an HTML mime type. Probably for the better, any suggestions. I could ping thunderstone and have them fix their crawler but I'm wondering if there is a better way Rails an handle this case. On Dec 31, 4:47 pm, Tony Primerano tony.primer...@gmail.com wrote: The thunderstone crawler (http

[Rails] rails version check for gems

2010-10-27 Thread Tony Primerano
rails 3 stuff else do what u were doing end Seems like that would break something once Rails 4 comes out. ;-) Pointers to best practices appreciated. Thanks Tony Primerano -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post

[Rails] Re: rails version check for gems

2010-10-27 Thread Tony Primerano
, Tony Primerano tony.primer...@gmail.com wrote: Seems like that would break something once Rails 4 comes out.  ;-) Couldn't you do this? if Rails::VERSION::STRING.to_i = 3   puts at least rails 3 else   puts rails 2 or lower end -- You received this message because you are subscribed

[Rails] raw needed on select tag options? Rails3/Ruby1.9.2

2010-10-12 Thread Tony Primerano
) When I do this I need to do use raw. %= select_tag months, raw(options) % Assuming this is WAD the documentation should probably be updated. Is there a better way to do what I am doing above (adding an option to the options_for_select output)? Thanks Tony Primerano -- You received

[Rails] undefined method `includes_values' for :conditions:Symbol

2010-10-11 Thread Tony Primerano
Rails 3 / Ruby 1.9.2 Over the weekend I saw the undefined method `includes_values' for :conditions:Symbol error for the 1st time while working with AAF.

[Rails] Assertions on ActiveRecord errors array

2010-09-24 Thread Tony Primerano
In Rails 2 if I wanted to check if an ActiveRecord attribute had an error on it I simply called assert user.errors.on(:name) Now that this is depreciated what is a clean way to do this check? This is ugly but it works.. assert !user.errors[:name].empty? remove the negative logic and it

[Rails] Re: Rails 2 to Rails 3 - How to convert this sql query ?

2010-09-08 Thread Tony Primerano
I'm not sure how to do the COUNT(widget_type_id) AS widgettypeid as this doesn't seem to work below but it is close. hoping someone will chime in. :-) I'm sure I'm missing something simple. Widget.group(:widget_type_id).select('widget_type_id, count(widget_type_id) AS

[Rails] Re: cache-money Rails3?

2010-09-07 Thread Tony Primerano
It appears that cache-money will not work with Rails 3 as-is because it hooks into 2 active record methods that no longer exist. :-( alias_method_chain :find_every, :cache alias_method_chain :find_from_ids, :cache With the whole ARel integration I wonder if hooking into the DB calls just got

[Rails] Re: ActiveRecord::ConnectionNotEstablished error

2010-09-07 Thread Tony Primerano
I've never used sqlserver before but I would start with the development.log file for clues. Assuming there is a command line client can you connect to the database with it? Can you ping your db host mordor? In dev the host is usually localhost (in linuxland anyway). On Sep 7, 12:30 pm,

[Rails] Re: Using Factory Girl with has many relationship

2010-09-03 Thread Tony Primerano
Try this Factory.define :article do |f| f.title Hello, world f.comments {|comments| [comments.association(::comment)]} end Factory.define :comment do |f| f.content Awesome! end On Sep 3, 6:07 am, Satsou Sa li...@ruby-forum.com wrote: Hello, I have this kind of relation:  

[Rails] Re: upgrading to rails 3.

2010-09-03 Thread Tony Primerano
try adding trace to your rake command to get more information rake rails:upgrade:check --trace On Sep 3, 5:32 am, Mauro mrsan...@gmail.com wrote: I've installed rails_upgrade plugin with ruby script/plugin installhttp://github.com/rails/rails_upgrade.git. Then if I run rake

[Rails] Disable Rails caching in test environment?

2010-09-02 Thread Tony Primerano
Is there a way to make Rails.cache.fetch always execute the code block in the test environment? (disable caching) For example in my test console on Rails 3 ruby-1.9.2-rc2 Rails.cache.fetch('foo') {'bar'} = bar ruby-1.9.2-rc2 Rails.cache.fetch('foo') {'bar44'} = bar Caching is on. Using

[Rails] Re: Disable Rails caching in test environment?

2010-09-02 Thread Tony Primerano
file. On Sep 2, 9:20 am, Tony Primerano tony.primer...@gmail.com wrote: Is there a way to make Rails.cache.fetch always execute the code block in the test environment?  (disable caching) For example in my test console on Rails 3 ruby-1.9.2-rc2 Rails.cache.fetch('foo') {'bar'}  = bar ruby

[Rails] Re: memcache in prod vs dev

2010-09-02 Thread Tony Primerano
Assuming you are using standard page/fragement/action caching you can just set config.action_controller.perform_caching = false in your development environment file. If you are making direct calls to Rails.cache you can use a cache store stub in development. I just did this today for my test

[Rails] should cache-money work with rails unit tests?

2009-11-01 Thread Tony Primerano
The Cache Money page (http://github.com/nkallen/cache-money) mentions For your unit tests, it is faster to use a Memcached mock than the real deal. Faster is fine but will it work with memcached? It doesn't work with mine, I suspect the cache is not cleared between tests. I suspect this is

[Rails] Re: Cheapest Rails Hosting where they give you full access to Apache (to load modules etc)???

2009-09-29 Thread Tony Primerano
You get your own server and set it up yourself. Some sysadmin skill are required but they have some good server setup articles. On Sep 27, 2:45 am, Greg Hauptmann greg.hauptmann.r...@gmail.com wrote: thanks - does Rackspacecloud have Ruby on Rails support (well like Dreamhost?), or it a get

[Rails] Re: Object has invalid ID after rollback

2009-09-29 Thread Tony Primerano
FYI. It appears there is a ticket on this issue https://rails.lighthouseapp.com/projects/8994/tickets/2991-after-transaction-patch On Sep 25, 4:31 pm, Tony Primerano tony.primer...@gmail.com wrote: On Sep 25, 3:44 pm, Jeff cohen.j...@gmail.com wrote: On Sep 25, 2:05 pm, Tony tony.primer

[Rails] Re: Object has invalid ID after rollback

2009-09-25 Thread Tony Primerano
actually making the id nil doesn't work either. guess it still has created_at and updated_at items. Anyway. Is there a simple way to remedy this issue? On Sep 25, 3:05 pm, Tony tony.primer...@gmail.com wrote: I suspect there is a standard way to handle this issue but I haven't found it.

[Rails] Re: Object has invalid ID after rollback

2009-09-25 Thread Tony Primerano
On Sep 25, 3:44 pm, Jeff cohen.j...@gmail.com wrote: On Sep 25, 2:05 pm, Tony tony.primer...@gmail.com wrote: I suspect there is a standard way to handle this issue but I haven't found it. In my controller create action I have a Transaction.  Lets say I'm creating a user object

[Rails] Re: Cheapest Rails Hosting where they give you full access to Apache (to load modules etc)???

2009-09-25 Thread Tony Primerano
Agreed. Rackspace is great. Especially when you're 1st building your application. I had apache/passenger and mysql running just fine on a 256MB instance. cost? about $11/month. http://www.tonycode.com/blog/archives/122 There is EC2 on Rails but AWS starts at about $90/month. I'm really

[Rails] Re: Active Merchant Error

2009-09-16 Thread Tony Primerano
You'll probably have better luck in the active merchant group http://groups.google.com/group/activemerchant?lnk= On Sep 16, 9:31 am, Ghanshyam Rathod rails-mailing-l...@andreas- s.net wrote: Hello friends, I  m using Active Merchant(version = 1.4.2)  gem. in billing calculator i m require