[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 wrote: > I forget why but I'm stuck using rubygems 1.7.2, which means I > occasionally get the dreaded "invalid date format in specif

[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/ gems/1.8/specifica

[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 pr

[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 ne

[Rails] Re: optional form :remote ?

2011-03-17 Thread Tony Primerano
On Mar 17, 4:39 pm, Philip Hallstrom 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 previe

[Rails] Re: Help with session

2011-03-17 Thread Tony Primerano
any before filters clearing it out? with AJAX, if your rails app is on a different domain than the page hosting the form the cookies may get blocked resulting in no session information being available. On Mar 17, 5:00 pm, radhames brito wrote: > On Thu, Mar 17, 2011 at 4:54 PM, Tony Primer

[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 wrote: > does it work when you uncomment this line in destroy? > > # @cart = current_cart > > On Mar 17, 4:31 pm, radhames brito wrote: &g

[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 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 create >     @c

[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 wrote: > I am new to RoR I have installed aptana, eclipse RoR plugin on ubuntu > 10.10. > but whether I create Rub

[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 ch

[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 ja

[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 he

[Rails] Re: default values and text_field

2011-02-11 Thread Tony Primerano
as nothing. Adding ':value => @test.value1' fixes the issue but shouldn't be necessary AFAIK <%= f.text_field :value1, :value => @test.value1 %> On Feb 11, 10:00 am, Jim Ruther Nill wrote: > are you sure that heading is nil? could you double check if it's not a

[Rails] Re: default values and text_field

2011-02-11 Thread Tony Primerano
On Feb 11, 8:45 am, Frederick Cheung wrote: > On Feb 11, 1:37 pm, Tony Primerano 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? ? 'Ple

[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 empt

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

2011-01-10 Thread Tony Primerano
gine asks sends "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 wrote: > It should be noted that while adding this fixed m

[Rails] Re: recommended HTTP client?

2011-01-06 Thread Tony Primerano
On Jan 6, 3:04 pm, Marnen Laibow-Koser 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 h

[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 wrote: > TonyPrimeranowrote in post #972234: > > > > > In the past I have used Net:

[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 goe

[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 wrote: > On Jan 3, 2011, at 3:08 PM, Tony Primerano wrote: > > > Post.where('draft is NOT true') > > That shouldn't work either.

[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: HTTP Accept header wildcard breaks rails app

2011-01-03 Thread Tony Primerano
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 wrote: > well.  adding > > Mime::Type.register &qu

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

2010-12-31 Thread Tony Primerano
efinition 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 wrote: > The thunderstone crawler (http://search

[Rails] HTTP Accept header wildcard breaks rails app

2010-12-31 Thread Tony Primerano
I tell my 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 Ton

[Rails] Re: rails version check for gems

2010-10-27 Thread Tony Primerano
yeah that works better. :-) How other gems are handling this. It looks like acts_as_ferret is only supporting Rails3 in > 0.5 so no need for version checks there (unfortunately it isn't quite rails 3 ready yet). On Oct 27, 9:41 am, Tim Shaffer wrote: > On Oct 27, 9:09 am, Ton

[Rails] rails version check for gems

2010-10-27 Thread Tony Primerano
ot;3") do 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&quo

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

2010-10-12 Thread Tony Primerano
ax_months).to_a, item.months) 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)? Th

[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. http://j-k.lighthouseapp.com/projects/45560-acts-as-ferret/tickets/176-aaf-051-undefined-method-includes_values-for-conditionssymbol#ticket-1

[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 widgettypeid').order(:w

[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: 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 har

[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 wrote: > I've installed rails_upgrade plugin with ruby script/plugin > installhttp://github.com/rails/rails_upgrade.git. > Then if I run rake rails:upgrade:check it says > rak

[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 wrote: > Hello, > > I have this kind of relation: > >   class Arti

[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 en

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

2010-09-02 Thread Tony Primerano
test.rb file. On Sep 2, 9:20 am, Tony Primerano 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'

[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. U

[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 j

[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 wrote: > On Sep 25, 3:44 pm, Jeff wrote: > > > On Sep 25, 2:05 pm, Tony wrote: > > > > I suspect th

[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 wrote: > thanks - does Rackspacecloud have Ruby on Rails support (well like > Dreamhost?), or it a get your own server & do it yours

[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 hap

[Rails] Re: Object has invalid ID after rollback

2009-09-25 Thread Tony Primerano
On Sep 25, 3:44 pm, Jeff wrote: > On Sep 25, 2:05 pm, Tony 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 here. > > > def new > >   User.tran

[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 wrote: > I suspect there is a standard way to handle this issue but I haven't > found it. > > In my controller cre

[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 wrote: > Hello friends, > > I  m using Active Merchant(version = 1.4.2)  gem. > in billing calculator i m require  'active_merchant'  and when i

[Rails] Re: controlling join table actions based on join table content

2009-09-11 Thread Tony Primerano
overriding the Movie destroy method works fine for killing 'fixed' contracts before ActiveRecord makes them null. At 1st I was thinking of catching the nullify via a callback on the Contract class (wasn't sure what I was going to do here but it appears the nullification doesn't invoke the callbac