[Rails] Rails 3.1.3 -> 3.2.3 upgrade, assets can't be found

2012-04-30 Thread Andrius Chamentauskas
Hello everyone, I'm upgrading one application from Rails 3.1.3 to 3.2.3 and run into a nasty problem that none of the assets are found (everything worked great before upgrade). I've investigated for several hours and it seems that the root of the problem is that the order of initializers becomes w

[Rails] Re: discriminating two FK references into one table?

2010-03-11 Thread Andrius Chamentauskas
Just do SalesFact.first(:include => [:on_market_date_dimension, :sale_date_dimension]). Then you can access dates with sales_fact.on_market_date_dimension and sales_fact.sale_date_dimension. On Mar 11, 6:54 am, Fearless Fool wrote: > Andrius Chamentauskas wrote: > > Well first of all

[Rails] Re: discriminating two FK references into one table?

2010-03-10 Thread Andrius Chamentauskas
Well first of all are you 100% sure you need OnMarketDateDimension and SaleDateDimension classes? If you don't have any custom logic in them you should probably remove them and change associations a bit: class SalesFact < ActiveRecord::Base ... belongs_to :on_market_date_dimension, :class_name

[Rails] Re: Email section

2010-03-10 Thread Andrius Chamentauskas
Hi, It was probably for old action mailer. You should use config.action_mailer.smtp_settings On Mar 10, 8:04 am, Manish Belsare wrote: > Sir , I want to implement email section in ma web application.. > so i found the method 'server_setting' for it... > Following is the method: > > config.action

[Rails] Ruby 1.9 loading rails is slow

2010-03-10 Thread Andrius Chamentauskas
Hello all, I've recently started a project and I wanted to give ruby 1.9 + rails a chance. Well everything works great, so far haven't encountered any gem that didn't work (so anyone out there you should give it a try). There's only one minor glitch: on ruby 1.8.7 loading rails environment takes 1

[Rails] Re: When is nil not false?

2009-04-18 Thread Andrius Chamentauskas
What about: def initialize(source=nil) source ? xchg_source(source) : xchg_source end Or if you prefer longer notation def initialize(source=nil) if source xchg_source(source) else xchg_source end Or like in your example: def initialize(source=nil) return xchg_source unless sourc

[Rails] Re: Create reports with ActiveRecord to download by user

2009-03-09 Thread Andrius Chamentauskas
On Mar 8, 5:02 pm, Shilo Ayalon wrote: > Hi - > > I want to enable the user to generate a report based on the database > used by the application. I have a few related questions: > > 1. Assuming my script is called 'create_report.rb' and stored under > /lib/tasks, how do I execute it from my con

[Rails] Re: How can I load a session from the cookie store manually?

2009-03-02 Thread Andrius Chamentauskas
This should help you do that http://dev.rubyonrails.org/browser/trunk/actionpack/lib/action_controller/session/cookie_store.rb Basically cookie consists of two parts. First is session data base 64 encoded and then url encoded, second is SHA1 hash of session data and secret server side password.

[Rails] Re: Converting console app to Shoes

2009-02-16 Thread Andrius Chamentauskas
Well first of all you will have to create EditBox and TextBlock. Then create a button passing a block to it. This block should read value of EditBox.text convert it and store it to TextBlock.text. You should probably read shoes elements documentation at http://help.shoooes.net/Elements.html On F

[Rails] Re: Maxima and Ruby Integration

2009-02-03 Thread Andrius Chamentauskas
Hm I'm not sure why does it freeze. You could try max.to_a.last or if all else fails try just skipping unnecessary lines using while loop On Feb 3, 3:36 pm, Richard Schneeman wrote: > >> max = IO.popen("maxima", "w+") > => # > >> max.readlines.last > > ^CIRB::Abort: abort then interrupt!! >   fr

[Rails] Re: Maxima and Ruby Integration

2009-02-03 Thread Andrius Chamentauskas
What about readlines.last? On Feb 1, 7:40 pm, Richard Schneeman wrote: > Thanks that did the trick. Do you know if there is an easy way to get > the last result, or everything without having to do so many "gets"? I > tried .each and readlines but with not much success. Or at least a way > to det

[Rails] Re: active_scaffold config issue? Complains about rails 2.2.2 dependency.

2009-02-01 Thread Andrius Chamentauskas
Maybe you have rails version configured in environment.rb? On Jan 30, 5:15 am, drub wrote: > Howdy all, > > Trying to start WEBrick.  The error is displayed "This version of > ActiveScaffold requires Rails 2.2 or higher.  Please use an earlier > version. (RuntimeError)" > > "gem list" shows "rai

[Rails] Re: Maxima and Ruby Integration

2009-02-01 Thread Andrius Chamentauskas
Pass "w" as second argument: IO.popen("maxima", "w") On Feb 1, 8:52 am, Richard Schneeman wrote: > I tried the following but i'm getting errors...am I missing something > here? > > >> f = IO.popen("maxima") > => # > >> f.puts "1+1;" > > IOError: not opened for writing >   from (irb):7:in `write'

[Rails] Re: Maxima and Ruby Integration

2009-01-31 Thread Andrius Chamentauskas
Well since it probably supports command line arguments, you could always use 'system' method On Jan 31, 5:22 am, Richard Schneeman wrote: > I'm looking to write a javascript heavy clientside program with a > something serverside backend that connects to the free maxima math > program. I have ext

[Rails] Re: remove element from array question

2009-01-27 Thread Andrius Chamentauskas
var1.all(:select => 'var1.*', :include => {:var2 => var3}, :conditions => ['var3.something = ?', some_value]) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send em

[Rails] Re: Hotlink Prevention in Ruby?

2009-01-11 Thread Andrius Chamentauskas
I think the safest way is to store images outside your public directory for storing images. Then create (controller and) action to retrive images using send_data. For example: @person = Person.find(@params['id']) File.open(@person.picture, "rb") do |image| send_data image, :filename => @person.

[Rails] Re: newbie trying self-referencing :through via REST model

2009-01-07 Thread Andrius Chamentauskas
try: class Person < ActiveRecord::Base has_many :vassalships,:class_name=>'Vassalship',:foreign_key=>'master_id' has_many :vassalship_belongings, :class_name => 'Vassalship', :foreign_key => 'slave_id' has_one :master,:through=>:vassalships,:source=>:person has_many :servants

[Rails] Re: has_one :through doesn't work in Rails 2.2.2

2009-01-05 Thread Andrius Chamentauskas
Maybe your defined rails version in environment.rb is not 2.2.2? --~--~-~--~~~---~--~~ 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 u

[Rails] Re: Installing RoR for a Newbie is a nightmare

2009-01-04 Thread Andrius Chamentauskas
Have you tried one click installer for windows? http://rubyforge.org/frs/download.php/47082/ruby186-27_rc2.exe You don't need to install rubygems then, you can simply run cmd and 'gem install rails' --~--~-~--~~~---~--~~ You received this message because you are sub

[Rails] Re: Rendering partials from outside of Rails

2009-01-02 Thread Andrius Chamentauskas
render :file => ... On Jan 2, 12:32 am, Jeff wrote: > I have a client Rails project, and I'd like to create a folder outside > of the Rails app completely. The client could create vanilla HTML > files and drop them into the folder. I'd then like to render those > HTML files as partials against t

[Rails] Re: Need help DRYing this code

2009-01-02 Thread Andrius Chamentauskas
1. You could create a partial with code between for and end, not including them. Then u can render that partial using render :partial => 'something', :collection => @projects. 2. dom_id(project) is same as "project_#{project.id}" 3. Try content_tag_for(:li, project, ...) instead of wrote: > I am

[Rails] Re: Failing to render RJS

2008-12-29 Thread Andrius Chamentauskas
You need to rename it to index.js.rjs. Check in firebug then if you get response. --~--~-~--~~~---~--~~ 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@goog

[Rails] Re: Question about "partial controllers" sub-applicaktions

2008-12-29 Thread Andrius Chamentauskas
http://m.onkey.org/2007/12/9/namespaced-models seems to be talking about same problems. You might wanna read it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send

[Rails] Re: Should I learn Ruby on Rails? What book?

2008-12-26 Thread Andrius Chamentauskas
It is for rails 2.2 and i believe they will get updated as new rails versions are released. On Dec 25, 7:04 pm, zero0x wrote: > Thank you very much, it looks great :) > > Is this for the latest version - 2.2 ? (Or at least Rails 2) > > On Dec 25, 3:09 pm, Davo wrote: > > > Hi There, > > Welcome

[Rails] Re: Non Default :primary_key doesnt get updated

2008-12-25 Thread Andrius Chamentauskas
Just to make sure you understand: t.integer "ida2a2" does not create primary key. All it does is create integer column name ida2a2. To create real primary key use t.primary_key "ida2a2". --~--~-~--~~~---~--~~ You received this message because you are subscribed to

[Rails] Re: Buttons with different actions... for a single form

2008-12-17 Thread Andrius Chamentauskas
Can't you just refetch user info from the database? On Dec 17, 4:02 pm, The Neurochild wrote: > I forgot to tell you it has to use elements of the form. The delete > user could be separated from the form, but the Prawn (PDF) button > functionality must have all the values of the form when someth

[Rails] ActiveRecord private method called

2008-12-14 Thread Andrius Chamentauskas
Ok so i just upgraded to rails 2.2.2 and now i'm getting error "Attempt to call private method". I found out that this is because my planet model has attribute named y, which seems is a private attribute in ActiveRecord::Base. I guess rails didn't check if it overwrites private methods before and

[Rails] Re: Need Help in converting php encryption decryption code to ruby on rails

2008-12-13 Thread Andrius Chamentauskas
Even though i think you should use some known encryption algorythm, here's translated source (not tested): require 'digest/md5' require 'base64' class String def ^(value) rez = "" self.length.times { |i| rez << (self[i] ^ value[i % value.length].to_i) } rez end end def get_rnd_i

[Rails] Re: Live Clock and Date on Rails

2008-11-22 Thread Andrius Chamentauskas
For a live clock it doesn't matter if it's PHP/JS or Rails/JS. If you know working example with PHP/JS then it will work with Rails/JS. Live clock is just JS script and the only thing it depends on is browser implementation. Maybe you just have some archaic browser? On Nov 22, 1:52 am, The Neuroc

[Rails] Re: How to pass parameters to after_update callback?

2008-10-24 Thread Andrius Chamentauskas
How about making two read-write attributes, one for changes and one for files, in Ticket model. They would be automatically assigned from params hash (yes you can assign any attribute using params hash, not only database related fields) and you could use them in after update method. On Oct 23, 3:

[Rails] Re: encrypt password on the browser

2008-10-24 Thread Andrius Chamentauskas
What about asymmetric encryption algorithms? You could use javascript to encrypt password using public key, and then this information could only be decrypted only by using private key, which could be stored safely in server and used in model for authentication or registration. I think example of t

[Rails] Re: RoR IDE - which one do you use?

2008-09-22 Thread Andrius Chamentauskas
I use Netbeans, even though java is pretty slow and not as responsive as I wished, it has every feature I can imagine and some that I couldn't. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" gro