[Rails] Re: asset pipeline/coffeescript triggering event twice instead of once

2012-04-01 Thread Bharat Ruparel
OK. I have figure this out and am posting the solution here so that someone who runs into this problem can benefit from this knowledge. At some point in time, I have pre-compiled the coffeescript files to javascript in my assets/javascripts folder and therefore there were corresponding javascr

[Rails] asset pipeline/coffeescript triggering event twice instead of once

2012-04-01 Thread Bharat Ruparel
This does not make any sense to me: I have a model called TypeWell along with it controller and forms. If I attach a jQuery event Handler using old fashioned Javascript code to its form partial like shown below: :javascript $(document).ready(function() { $("#type_well_gas_type").change(fu

[Rails] ActiveRecord Query

2011-12-25 Thread Bharat Ruparel
Having a tough time creating a where clause and/or query for the following situation for a table. Will appreciate some help: 1. Need to filter records for a specific client_id. No problem, straightforward where condition 2. For the specific client records found in step 1, need to further filt

[Rails] Coffeescript being compiled to javascript

2011-11-03 Thread Bharat Ruparel
I am using Rails 3.1.1 with asset pipeline and coffeescript. I have a number of Coffeescript files in the app/assets/javascripts directory. Whenever I make a change to the coffeescript files in that directory, it is producing a corresponding javascript file automatically. The changes that I make

[Rails] Re: Rails 3.1.1 serious problems with model

2011-10-27 Thread Bharat Ruparel
Thanks Mike. A big mistake on my part. I had forgotten that I had defined a scratch class called Well (what else?) in my lib folder for some computations. This well class does not have an ancestor and therefore naturally inherits from Object. It turned out that it was overriding my model clas

[Rails] Rails 3.1.1 serious problems with model

2011-10-27 Thread Bharat Ruparel
I have a model called Well in my app stored in well.rb under app/models. This has worked fine for quite some time. All of a sudden I noticed that the whole Well section (model/controller/view) was behaving strangely. I have tracked it down to the model not being recognized as an ActiveRecord::Bas

[Rails] Rails 3.1.1 and ssl

2011-10-10 Thread Bharat Ruparel
Rails 3.1.1 makes it super easy to force ssl communication in production by setting the following flag in the config/environments/production.rb file: # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. config.force_ssl = true I want to only require

[Rails] data entry in a tabular format

2011-09-20 Thread Bharat Ruparel
Is there a gem out there which helps in laying out a data entry/edit form in a tabular format? What I am looking for is something like months across as columns and years for rows. And be able to enter/edit values for two different attributes for each cell. Bharat -- Posted via http://www.ruby-

[Rails] jquery UI with rails 3.1

2011-08-06 Thread Bharat Ruparel
What is the correct way to configure jQuery UI with Rails 3.1 application? Bharat -- Posted via http://www.ruby-forum.com/. -- 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@googlegrou

[Rails] Cookies - Written by Javascript Read by Rails

2011-05-21 Thread Bharat Ruparel
Is there a way for Rails to read cookies written by a Javascript and read by Rails? -- I am integrating a third party software service which writes a cookie to the user's browser which contains routing information. I need to make sure that the Rails app and the third party app both have the same

[Rails] Active Record Query

2011-02-19 Thread Bharat Ruparel
A course has many lessons and a lesson has many topics. A topic can have a recipe or vice versa, a recipe has many topics (optional). I need to come up with the most efficient way of querying the database to find those topics belonging to a course (via lessons of course) which have a recipe (in ot

[Rails] Rails 3 with Facebook

2011-01-26 Thread Bharat Ruparel
What are some of the options for integrating a Rails 3 app with Facebook? Bharat -- Posted via http://www.ruby-forum.com/. -- 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@googlegroup

[Rails] Re: tracking the shopping cart for an unregistered user

2011-01-16 Thread Bharat Ruparel
Hello Chris, Thanks for the response. Yes it is a good idea to expire this kind of session data. My question was more about how to track an anonymous user across sessions reliably. The only thing that I can think of is doing this based on the IP address which can be unreliable? What if there

[Rails] tracking the shopping cart for an unregistered user

2011-01-16 Thread Bharat Ruparel
What is a good way to track the shopping cart for an unregistered user? For a user session it is easy, but what if the user logs in, adds a few items in the cart, and decides to terminate the session and then returns later? What are some of the design trade-offs? Bharat -- Posted via http://www.

[Rails] Streaming video servers for Ruby on Rails App

2010-11-20 Thread Bharat Ruparel
We have an application that makes heavy use of Videos that need to be served from a streaming server. Ideally, this server should be able to support both quick-time and flash clients (e.g. IPad and Android tablets). If anyone has any suggestions based on a product/vendor that has worked well, ple

[Rails] Re: Re: Rails 3 render partial

2010-09-13 Thread Bharat Ruparel
Hello, You are right about the object deprecation in Rails 3. I solved the problem the same way you did. Instead of passing the table name in object. I now pass it in the locals hash. Hope this helps. Bharat -- Posted via http://www.ruby-forum.com/. -- You received this message because you

[Rails] Re: Rails 3 - the most annoying deprecation warning

2010-08-29 Thread Bharat Ruparel
"If save(false) isn't something that you're calling in your code it is likely in plugins or gems that you're loading." --- Thank you for your time. This makes sense. However, there is not a single place in my application where I am calling save(false) and this warning is triggered all over the

[Rails] Updated Internet file managers for Rails 2.3.8 and Rails 3.0

2010-08-29 Thread Bharat Ruparel
http://github.com/bruparel/file_manager238 http://github.com/bruparel/file_manager3 Just got done. Enjoy. Bharat -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send emai

[Rails] More deprecation warnings

2010-08-29 Thread Bharat Ruparel
How can I fix the following code for deprecation warning? def correct_client_assignment role = Role.find_by_name('eclient') if client_id.blank? && role_id == role.id errors.add :client_id, "must assign an external client to this user" elsif !client_id.blank? && role_id != role.

[Rails] Rails 3 - the most annoying deprecation warning

2010-08-29 Thread Bharat Ruparel
I just successfully converted my Rails 2.3.8 app to Rails 3.0 Release candidate 2! I will post both the apps on my github account for everyone else. I do want to clean up the deprecation warnings as best as I can before I post them though. By far the most frequent deprecation warning that shows

[Rails] Rails 3 warning

2010-08-27 Thread Bharat Ruparel
../home/bruparel/.rvm/gems/ruby-1.9.2-head/gems/right_aws-2.0.0/lib/awsbase/support.rb:47: warning: toplevel constant ClientStatus referenced by Client::ClientStatus /home/bruparel/.rvm/gems/ruby-1.9.2-head/gems/right_aws-2.0.0/lib/awsbase/support.rb:47: warning: toplevel constant Client referenced

[Rails] Re: Layouts in Rails 3.0

2010-08-26 Thread Bharat Ruparel
Hello Johndel, Thanks for your response. Unfortunately, it did not work. I typed in layout "admin" instead of layout :admin Still. No luck. Bharat -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Tal

[Rails] Layouts in Rails 3.0

2010-08-25 Thread Bharat Ruparel
I have an admin section in my rails 3 app. where I want to use a different layout than the main layouts/application.html.haml layout. Here is the snippet of the admin_controller.rb: class AdminController < ApplicationController current_section :admin layout :admin . . end Here are the

[Rails] Rails 2.3.8 to Rails 3 - nested layouts

2010-08-24 Thread Bharat Ruparel
The following code works great in Rails 2.3.8 layouts/application.html.haml ... .secondary-navigation = yield :secondary_nav .clear ... layouts/admin.html.haml - content_for :secondary_nav do = navigation :second_level_admin = render :file => "layout

[Rails] Re: Delete link in Rails 3

2010-08-18 Thread Bharat Ruparel
Please disregard. It turns out that I was using the wrong rails.js file with jQuery plus the wrong version of jQuery. Please watch the latest RailsCast from Ryan Bates to get around this problem. Thanks. Bharat -- Posted via http://www.ruby-forum.com/. -- You received this message because yo

[Rails] Re: Delete link in Rails 3

2010-08-18 Thread Bharat Ruparel
Hello Thani, I tried that, but no luck. The edit link that goes with delete link works fine. It is shown below: = link_to 'Edit', :controller => controller_name, :action => 'edit', :id => rec.id Corresponding routes.rb file snippet is shown below: ... resources :clients do member do

[Rails] Delete link in Rails 3

2010-08-17 Thread Bharat Ruparel
Closing in steadily on my Rails 3 upgrade. I can see the finish line. A few more wrinkles to iron out. My Rails app uses jQuery and Haml. I downloaded the rails.js and put it in my application.html.haml as I show below: !!! %html{:lang => "en"} %head %meta{"http-equiv"=>"Content-Type",

[Rails] Re: Extending ActiveRecords in Rails 3

2010-08-17 Thread Bharat Ruparel
Problem solved. Moved the file into: Rails.root/config/initializers directory and it worked. Bharat -- Posted via http://www.ruby-forum.com/. -- 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 rubyo

[Rails] Extending ActiveRecords in Rails 3

2010-08-17 Thread Bharat Ruparel
I have added a method to the ActiveRecords module and put it in the lib directory like so: module ActiveRecord class Base def self.my_search(search, current_page, search_field, user_role, perms) ... end end end This method has worked flawlessly in Rails 2.3.x and still works fi

[Rails] Re: Rails 3 flash message problems

2010-08-16 Thread Bharat Ruparel
Sorry, Did not ask my question properly. You are right, Rails 3 is safe by default. What I meant to ask is how do I fix the method shown above so that the rendered HTML is not escaped and therefore displays properly? Thanks. Bharat -- Posted via http://www.ruby-forum.com/. -- You received th

[Rails] Rails 3 flash message problems

2010-08-16 Thread Bharat Ruparel
The following code in my application_helper.rb class either eats the flash message or escapes it and does not display properly: # Outputs the corresponding flash message if any are set def flash_messages messages = [] %w(notice warning error).each do |msg| messages << content_tag

[Rails] Initializers from Rails 2 to Rails 3

2010-08-15 Thread Bharat Ruparel
I am upgrading an app from Rails 2.3.8 to Rails 3.0. I am finding that the initializers in the initializers directory do not seem to load. Is there any way to configure it. In general, what are the new load procedures for Rails 3? Thanks. Bharat -- Posted via http://www.ruby-forum.com/. -- Yo

[Rails] Re: Rails 3 safe strings

2010-08-08 Thread Bharat Ruparel
Please disregard. This was my error. I had a field_error method in one of my initializer classes as shown below: ActionView::Base.field_error_proc = Proc.new do |html_tag, instance_tag| if html_tag =~ /type="hidden"/ || html_tag =~ /#{html_tag}".html_safe end end I had simply forgotten to

[Rails] Rails 3 safe strings

2010-08-08 Thread Bharat Ruparel
I am trying to convert my Rails 2.3.5 app to 2.3.8 and then to Rails 3.0 Currently, I am upgrading to Rails 2.3.8. The default escaping behavior is causing all kinds of problems. I have installed the rails_xss plugin from the following url: http://github.com/rails/rails_xss And am trying to foll

[Rails] Rails 3 render partial

2010-07-19 Thread Bharat Ruparel
The following rails 2.3.x code is not working in rails 3 beta 4: def render_crud_table(obj,controller_name,columns,search_fields_array,status_array,actions) render :partial => 'shared/crud_maint_table', :object => obj, :locals => {:controller_name => controller_name, :columns => columns

[Rails] Re: Rails 3 Upgrade

2010-07-18 Thread Bharat Ruparel
Apologies. Please ignore. I had forgotten to include my initializer to load files from the library path. Thanks. Bharat -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, s

[Rails] Rails 3 Upgrade

2010-07-18 Thread Bharat Ruparel
I have a working 2.3.5 rails app that I am upgrading to rails 3 beta 4. I had monkey-patched a couple of class methods to the Activerecord::Base class and put it in the lib directory. This has worked fine for ages in 2.3.x, but Rails 3 is refusing to even recognize it. I get undefined method erro

[Rails] Rails 2.3.2 upgrade to 2.3.8 problem

2010-06-23 Thread Bharat Ruparel
Upgrading to Rails 2.3.8 from 2.3.2 has broken views in my application. Specifically the field labels are all displaying after the label text and therefore the alignment is all messed up. Instead of nicely aligning with the label text on the top and text entry field under it, they line up side-b

[Rails] Re: Re: Re: stored procedures and ROR

2010-06-22 Thread Bharat Ruparel
Sampath, Five minutes of googling turned up a ton of references. Check out the following: http://nasir.wordpress.com/2007/12/03/stored-procedures-and-rails/ http://guyharrison.typepad.com/guy_harrisons_blog/2006/04/mysql_stored_pr.html http://paslogic.com/?p=13 There were many more. Type in

[Rails] Re: Ajax request and redirection

2009-07-04 Thread Bharat Ruparel
Quick edit: On the client side, Firefox does not show any error. I meant to say: On the client side, Firebug in Firefox does not show any error. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribe

[Rails] Ajax request and redirection

2009-07-04 Thread Bharat Ruparel
This is most likely my lack of understanding of Ajax concepts, but I cannot find an answer on the web for the following question: "Should an ajax request triggered by a specific page must come back to the same page?" Here is my jQuery handler in the jsTree that communicates with my server side R

[Rails] Ruby on Rails Guides

2009-06-25 Thread Bharat Ruparel
The Rails Guides are at the following address: http://guides.rails.info/ They look really good. I am particularly interested in learning how to create the nice looking pop-up menu when you click on the "Guides Index" link. Does anyone know where can I find information on how to do create such

[Rails] Re: jQuery UI with Rails

2009-05-10 Thread Bharat Ruparel
I caution you not to jump to conclusions. This is due to jQuery UI themes that is not part of the core jQuery library. So you can still get a lot done without having to do what I had to do. Even without the CSS magic, the core functionality is working fine :) But it is clear to me that eit

[Rails] jQuery UI with Rails

2009-05-09 Thread Bharat Ruparel
This has to do more with Rails than jQuery so I am posting it here. I am using jQuery UI widgets in my application. One of the CSS file is called ui.theme.css which has references to background-image as shown below: .ui-widget-content .ui-icon {background-image: url(images/ui-icons_22_256x2

[Rails] Passenger restart problems

2009-04-23 Thread Bharat Ruparel
I am following the Passenger/Capistrano/Git deployment process outlined in Chapter 28 of the Third Edition of Agile Development book. Everything seems to work well except being able to restart my application. I am on Ubuntu 8.10. Here is my configuration info: 1. httpd.conf file in /etc/apache2 i

[Rails] Re: current_user in a model observer

2009-04-20 Thread Bharat Ruparel
Forget it. Bad design. I am not pursuing this path anymore. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email

[Rails] current_user in a model observer

2009-04-20 Thread Bharat Ruparel
I need to get the current_user id in my model observers: Here is the code for current_user in the lib/authentication.rb file: module Authentication def self.included(controller) controller.send :helper_method, :current_user, :logged_in?, :has_role?, :is_admin? end def current_user

[Rails] Rails Guides

2009-04-13 Thread Bharat Ruparel
I am using Rails Guides more frequently now and like them a lot. Very well done indeed. Here is the link: http://guides.rails.info/ Bharat -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

[Rails] Re: Multi-button form

2009-04-12 Thread Bharat Ruparel
Following up: The problem is solved: Here is the solution: I had to convert the id from integer to string as shown below: @status_array = ProspectStatus.all.collect {|e| [e.name,e.id.to_s]} Bharat -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~-

[Rails] Re: Multi-button form

2009-04-12 Thread Bharat Ruparel
Hello Perry, Thanks for your time. I managed to fake it :). Actually, it looks even better and it works too! here is what I did: <% form_tag({:controller => controller_name, :action => 'index'}, {:method => :get, :class => 'form'}) do %> <%= radio_button_tag(

[Rails] Multi-button form

2009-04-12 Thread Bharat Ruparel
It cannot be this difficult, especially in rails. Here is my form code in a partial for the index action of a controller: <% form_tag({:controller => controller_name, :action => 'index'}, {:method => :get, :class => 'form'}) do %> <%= label_tag :search, "Search b

[Rails] Re: render problems in upgrading from 2.1.2 to 2.3.2

2009-04-09 Thread Bharat Ruparel
Found the solution here: http://ryandaigle.com/articles/2008/11/20/what-s-new-in-edge-rails-render-stops-being-high-maintenance Changed the 4th line to: <%= render :file => "layouts/application" %> That solved the problem. Please disregard. Apologies for the trouble. Bharat -- Posted via h

[Rails] render problems in upgrading from 2.1.2 to 2.3.2

2009-04-09 Thread Bharat Ruparel
My custom layout file for the AdminController in in views/layouts/admin.html.erb and has the following code: <% content_for :secondary_nav do %> <%= sub_navigation [:prospect_statuses, :client_statuses, :business_statuses, :discounts, :features, :links, :user_types] %> <% end %> <%= render "lay

[Rails] Edit masks for form fields

2009-04-08 Thread Bharat Ruparel
I have several fields in forms that have either dollar values, e.g., book value, and integer values, e.g., age of the building. I would like to put some edit masks on them. What is the easiest way of doing that in Rails? Bharat -- Posted via http://www.ruby-forum.com/. --~--~-~--~

[Rails] Forms - Edits and Shows reuse

2009-04-03 Thread Bharat Ruparel
Is there a way to "lock" the entire form from edits? and make it read-only? The reason I ask is that in bigger forms, I would prefer to draw it only once in a partial and use it for new/edit and show actions. It gets tedious to have to redo the form for show action. Thanks for your time. Bharat -

[Rails] Re: class versus instance method - how?

2009-04-02 Thread Bharat Ruparel
Thank you Fred. You are right, I did not understand it. Now I do. I do get a bit "mixed-up" with all these "mix-ins" sometimes :) -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[Rails] class versus instance method - how?

2009-04-02 Thread Bharat Ruparel
I have a file call authentication.rb in rails root/lib directory which has the following method defined amongst others: module Authentication ... def authorize_admin? logged_in? && has_role?('admin') end ... end This module is included into application.rb as follows: class Applicati

[Rails] Re: conditional root in routes.rb

2009-04-02 Thread Bharat Ruparel
Thank you for your response Greg. I found that I was making my code progressively worse by trying to do the conditional routing in routes.rb file. Instead, I decided to do it the old-fashioned way as shown below: <% if authorize_admin? %> <%= navigation [:prospe

[Rails] conditional root in routes.rb

2009-04-01 Thread Bharat Ruparel
I am trying to setup role based routing in my application. Something similar to the following: map.root :controller => (authorize_admin? ? 'prospects' : 'welcome') I am getting an error that authorize_admin? is not defined. It is defined under lib directory and I can successfully call it fro

[Rails] Re: No such file or directory - layouts/application.html.erb

2009-03-30 Thread Bharat Ruparel
Got it. I had to say: <% content_for :secondary_nav do %> <%= navigation [:crust_types, :toppings] %> <% end %> <%= render "layouts/application" %> Note that I deleted the word "file" from the last statement which was: <%= render file "layouts/application" %> I have no idea why it works in

[Rails] Re: No such file or directory - layouts/application.html.erb

2009-03-30 Thread Bharat Ruparel
Eric wrote: > On Mar 30, 11:43�am, Bharat Ruparel > wrote: >> What is it that I am missing here? > > <%= render :file => "layouts/application" %> > > That comports with your error, right? Seems too simple of a solution, > but keep in

[Rails] No such file or directory - layouts/application.html.erb

2009-03-30 Thread Bharat Ruparel
This is very frustrating. I am defining a layout for my AdminsController class index action which is as follows: class AdminsController < ApplicationController before_filter :signal_child_menu #current_tab :admin def index @child_menu = true @search_field = "name" @crust_typ

[Rails] Two level Navigational menus

2009-03-28 Thread Bharat Ruparel
This has turned out to be a bit more difficult than I anticipated. I thought that creating two levels of generic navigational menus should not be that difficult. May be I am missing something. I have done it by borrowing code from various sources and modifying it. Still, the code is not clean

[Rails] Re: Rails 2.1.2 to 2.3.2 problems

2009-03-25 Thread Bharat Ruparel
Thanks Fred. Here is what I did after reading the link that you posted: I created the config/initializers/load_lib_dir.rb with the following line of code: Dir.glob( "#{ RAILS_ROOT }/lib/*.rb" ).each { |f| require f } <-- thanks Greg. I guess, I have some homework to do on the initializers.

[Rails] Re: Rails 2.1.2 to 2.3.2 problems

2009-03-25 Thread Bharat Ruparel
Figured it out: Rails 2.3 has a problem with requiring any files within the initializer block as shown below. Rails::Initializer.run do |config| require "#{RAILS_ROOT}/lib/active_record_extensions.rb" end Instead, it wants you to put your require statement outside the block as shown below

[Rails] Re: Rails 2.1.2 to 2.3.2 problems

2009-03-25 Thread Bharat Ruparel
Hello Conrad, I am making good progress towards resolving this, but am not there entirely. Following is my abbreviated environment.rb file. Note that I have commented out the RAILS_GEM_VERSION line so that the latest rails 2.3.2 is loaded. # Specifies gem version of Rails to use when vendor/

[Rails] Re: MonkeyPatching ActiveRecord::Base class

2009-03-25 Thread Bharat Ruparel
"However when you have a file in lib that is just adding a method to some existing class or overriding something then there is no constant like Discombobulator that will trigger loading of the file." Got it. Thanks. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~

[Rails] Re: Rails 2.1.2 to 2.3.2 problems

2009-03-25 Thread Bharat Ruparel
Hello Conrad, you wrote: > > Hi, did you update your configs? > > rake rails:update > > -Conrad No. I had not done that, but after reading your reply I did, but I get the same error :) as can be seen below: brupa...@bcr-d810:~/exp/pizzeria-3$ cd config/ brupa...@bcr-d810:~/exp/pizzeria-3/con

[Rails] Rails 2.1.2 to 2.3.2 problems

2009-03-25 Thread Bharat Ruparel
I just installed Rails 2.3.2 and tried to upgrade my test app from 2.1.2. After installing Rails 2.3.2, I simply changed the gem version in my environment.rb file in config directory as shown below: # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3

[Rails] Re: MonkeyPatching ActiveRecord::Base class

2009-03-25 Thread Bharat Ruparel
"The difference with a file like the one you had is that there isn't a top level constant one would naturally refer to)" Thanks for the explanation Fred. But I don't understand this. Can you give me a simple example? Bharat -- Posted via http://www.ruby-forum.com/. --~--~-~--~~

[Rails] Re: MonkeyPatching ActiveRecord::Base class

2009-03-25 Thread Bharat Ruparel
Thank you Fred and Greg. You both are right. I had a similar load configuration block as Greg shows here in my environment file in the application where it worked fine and had forgotten all about it. For this little application, I put the following statement at the end of config/environment

[Rails] Re: MonkeyPatching ActiveRecord::Base class

2009-03-25 Thread Bharat Ruparel
I have reduced the problem down to the following: whatever method I define in the lib directory under active_record_extensions.rb, is not being loaded by rails. This has worked perfectly for me in a large Rails 2.1.0 application. So here is the problem: RAILS_ROOT/lib/active_record_extensi

[Rails] Re: MonkeyPatching ActiveRecord::Base class

2009-03-25 Thread Bharat Ruparel
Could not get to it yesterday due to other work. Am still struggling with it. There is something basic that I do not understand. I have looked at acts_as plugins (list and tree for instance). I am afraid that is not going to help me. Here is the thing that I do not get: 1. The Rails lib

[Rails] Re: MonkeyPatching ActiveRecord::Base class

2009-03-23 Thread Bharat Ruparel
Thanks Phillip. I will follow your advice and see if I can do it. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send e

[Rails] MonkeyPatching ActiveRecord::Base class

2009-03-23 Thread Bharat Ruparel
I am trying to monkey-patch the ActiveRecord::Base class to incorporate a generic search class method so that it can be used by all model classes which need this functionality. Since model classes directly inherit from ActiveRecord::Base and unlike controllers and helpers, do not have an ancestor

[Rails] Re: Generic link_to in a shared partial

2009-03-20 Thread Bharat Ruparel
Hello Jason, Thanks for your response. Unfortunately that won't work since the local variable ll being passed to the partial determines which model are we working with so in my example that will have to be edit_crust_type_path(a_rec). It is the dynamic substitution of the model name that I a

[Rails] Generic link_to in a shared partial

2009-03-20 Thread Bharat Ruparel
I am trying to write a simple and generic one table maintenance shared partial which can be reused to maintain multiple tables with the following fields: id, name, created_by, updated_by. I am stuck in generating rest route correctly. Here is an example for a "crust_types" table inspired by Rya

[Rails] Rails UI widgets

2009-03-05 Thread Bharat Ruparel
Are there any popular plugins/gems for creating/generating rails UI elements such as navigation, progress bar, forms, tabular displays etc? Seems like I am doing that over and over again and differently each time? Let me clarify my question: while everyone is free to choose whatever they want for

[Rails] Re: Redirect_to Vs Render_component

2009-02-15 Thread Bharat Ruparel
1. place where you want to save your hash: flash[:my_hash] = some_hash 2. place where you want retrieve your saved hash in flash: this_hash = flash[:my_hash] Now this_hash has your saved data. Bharat -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--

[Rails] Re: Restful routes and Rails Console

2009-01-28 Thread Bharat Ruparel
Thank you Steve. This is precisely what I needed. Thomas, I appreciate your time as well. It is just that I learn better by typing "things" in the Rails Console in bits and pieces and see what happens. It is this interactive nature of Ruby and Rails which I like very much. Reminds me of the

[Rails] Re: How to add fields dynamically?

2009-01-28 Thread Bharat Ruparel
You will need Javascript for this sort of thing as Ryan Bates points out in his screen casts. There are many ways to do it, e.g., RJS templates or unobstrusive Javascript. Next in your create action, you will have to loop through the newly added rows to the database. It sounds simple, but it

[Rails] Restful routes and Rails Console

2009-01-28 Thread Bharat Ruparel
The following is a snippet of the routes.rb file: map.resources :blogs do |blog| blog.resources :posts do |post| post.resources :comments end end The index action in the CommentsController shows: redirect_to comments_url I am trying to see what comments_url resolves to in

[Rails] Re: jQuery with Rails

2008-12-24 Thread Bharat Ruparel
The problem is solved. I changed the "change" event to "clicked" event as shown below: jQuery(function(){ jQuery('#has_expiration_date input').change(function(){ jQuery('#discount_order__codes_expire_at').attr('disabled', !jQuery('#discount_order__codes_expire_at').attr('disabled')) });

[Rails] jQuery with Rails

2008-12-23 Thread Bharat Ruparel
In a nutshell, my jQuery code in a rails form works in Firefox, but not in Internet Explorer 7. Here is the form code with unnecessary details stripped out: New Discount Order <%= error_messages_for :discount_order %> <% vertical_form_for :discount_order, @discount_order, :url => discount_orde

[Rails] Re: Active Record - find - select option

2008-12-13 Thread Bharat Ruparel
Hello Mark, Priya, and Fred, I sincerely appreciate you all taking trouble to share your knowledge with me. I had to be away from development for a day and half to attend to other urgent matters. I am back on the job and going through your feedback. I will post the results as soon as I have

[Rails] Re: Active Record - find - select option

2008-12-11 Thread Bharat Ruparel
I should mention something else. I am on Rails 2.1.0 and even find_by_sql does not return columns from multiple tables as the Rails API documentation says: This example is from Rails API docs: # A simple SQL query spanning multiple tables Post.find_by_sql "SELECT p.title, c.author FROM pos

[Rails] Re: Active Record - find - select option

2008-12-11 Thread Bharat Ruparel
Mark, Thanks for your response. I tried that and the ids are indeed being returned by not the accounts.name. I am not sure why. Bharat -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the G

[Rails] Active Record - find - select option

2008-12-11 Thread Bharat Ruparel
I have an accounts table and a coaches table. The tables are as follows (with unimportant fields deleted): Accounts (id, name,...) Coaches (id, account_id, business_id, account_limit) Each account can either have one (or none) coach at any point in time. I have modeled these relationships in

[Rails] Representing left outer join in MySQL and Rails

2008-11-10 Thread Bharat Ruparel
I have to create a query from two tables. Table 1 is the accounts table and table 2 is the payments table. Each account can have many payments. I have to create a query that lists all accounts with the last payment. If there are no payments then the query displays no information for the payments

[Rails] Re: BackgroundRB - not listening to mongrel/nginx

2008-11-10 Thread Bharat Ruparel
Great work Max. Do you want to share with us what you did to create a custom log and actual troubleshooting process? Thanks. Bharat -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[Rails] Re: Attachment_Fu ImageScience and FreeImage problems

2008-11-06 Thread Bharat Ruparel
I have managed to get around this problem by installing ImageMagick and RMagick combination. So not an attachment_fu problem afterall. Does anyone have decent installation instructions for ImageScience and FreeImage on Ubuntu 7.10? I installed FreeImage from source and am not sure what went w

[Rails] Attachment_Fu ImageScience and FreeImage problems

2008-11-06 Thread Bharat Ruparel
I have been trying to run the UploadImages Recipe from Mike Clark's Advanced Rails Recipes book. I have installed both ImageScience and FreeImage on my Ubuntu 7.10 box. When I run the program and try to upload an image, I get a strange error which appears as follows: ActionController::RoutingEr

[Rails] Re: backgroundrb misbehaving again

2008-10-28 Thread Bharat Ruparel
Please disregard. For those who might be interested, the problem was that Backgroundrb had spawned a rogue linux process on the port that backgroundrb was supposed to listen on and will not go down when you shut Backgroundrb via normal commands. I had to find it and then do a kill -9. After th

[Rails] backgroundrb misbehaving again

2008-10-28 Thread Bharat Ruparel
I have a really strange problem with Backgroundrb. On one of my staging servers, it is not recognizing the RAILS_ENV variable for some reason. I have tried everything I could, that is: a) stopping and starting from the command line by issuing the following command RAILS_ENV=staging script/backg

[Rails] Re: HAML

2008-10-22 Thread Bharat Ruparel
Are there any simple tutorials to get started with HAML? Thanks. Bharat -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, s

[Rails] Re: Creating Unique Votes

2008-10-22 Thread Bharat Ruparel
I think that you want to build in an authentication system first (restful_authentication) so that you can reliably identify who the user is. After that it is a simple matter of logging a record in a table that identifies that a user has voted on a specific word. So always check beforehand if

[Rails] Re: So many users, so little time - looking for a better way

2008-10-21 Thread Bharat Ruparel
Hemant Kumar wrote: > Can you file a bug report with a reliable way to reproduce them? I am > sure, we can iron it out. OK Hemant, I will try to do it as constructively as possible. You have been most helpful. Just the thought of debugging Backgroundrb requires a lot of determination and wil

[Rails] Re: Extended tutorials?

2008-10-18 Thread Bharat Ruparel
Actually there is at least one that I know of and highly recommend. Please use the following link: http://www.buildingwebapps.com/podcasts Both Michael Slater and Christopher Haupt do an excellent job of walking you through Rails capabilities end-to-end. Admittedly, you won't be an expert by

[Rails] Re: Moving from one dns domain to another

2008-10-07 Thread Bharat Ruparel
Thanks Freddy, This was very helpful too. Regards, Bharat -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ 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 r

[Rails] Re: Moving from one dns domain to another

2008-10-07 Thread Bharat Ruparel
As always, thanks Peter. Regards, Bharat -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ 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@g

  1   2   >