Modifying an Existing Rails Gem
I'm playing around with MongoMapper and have cloned the repository. I'd like to start modifying the code but am new to Rails and am not sure how to do this. ...
I'm playing around with MongoMapper and have cloned the repository. I'd like to start modifying the code but am new to Rails and am not sure how to do this. ...
So, my app has a javascript alert... how do I, using cucumber and / or capybara, test that the alert hay a particular string? ...
I'm in that horrible questioning state. No, not trying to figure out if I'm gay. I'm trying to decide between Django and Rails. From what I've read, Django probably fits my needs better, both from a "cultural" and goal point of view. The baked-in admin interface pretty much sells me alone. However, I have one critical concern: it look...
In the .Net universe I can use an arbitrary SELECT statement and load many rows into DataTable object. I can then find various DataRows using various field criteria (Name='Jack', Age=34, etc.). In Ruby on Rails, after doing this to load all employees into memory rs = Employee.find(:all) I want to seek a row based an arbitrary crit...
In Ruby on Rails routing (using route.rb), can it say, for any URL having the form: www.example.com/ ... #! ... then use controller redirect ? This is so that in AJAX, some page can tag the #! at the end of URL so that the real content of interest is the part after the #! ...
Hi everybody. My rails app. uses mysql database and I need to generate .sqlite3.databases. Is it possible to use activerecord and rails models for it? We are trying now to use models namespaced by Remote:: module but by this way we can't start concurrent generators. ...
Hi i have a following huge string format example format : p=" --0016367d537a47795e0489ecb3c7\nContent-Type: text/plain; charset=ISO-8859-1\n\nok this is tested here\n and again going to test it \n\n\nOn Sat, Jun 26, 2010 at 4:20 PM, kumar \n <[email protected]> wrote:\n\n>" From the above huge string i need only the following cont...
Hello every body, After saving some values into the database, I am finding it difficult to print them out. Though I have been able to pull the data out of the database, the output is like the following: @vars={:object=>"46789620999001", :source_id=>1, :comment=>"["This is my first commenttoday and tommorrow", "This is my first comme...
I have such code in new.erb.html: <% form_for(@ratification) do |f| %> <%= f.error_messages %> <% f.fields_for :user do |fhr| %> <p> <%= fhr.label :url %><br /> <%= fhr.text_field_with_auto_complete :url %> </p> <% end %> <% end %> If i have empty Ratification.rb it is ok, fields_for works ok. But if I wr...
I am writing a plugin for Rails and I want to be able to use the main layout within the plugin. The usual style layout :layout_name , doesn't work for some reason. Am I missing something? A tip will be greatly appreciated. ...
Hi guys, I've been struggling with this one the whole day. In my Rails 2.3.5 app, I had a bunch of custom code which allowed the following to happen: >> strip_hash_keys_for_json({ "a" => 1 }).to_json => "{ a: 1 }" So you see that string keys don't get quoted. It was implemented by creating a String descendant class that returned self...
Using Microsoft's ADO.net, one can you query database -> disconnect database connection -> query/manipulate locally -> connect again (re-synchronize local with database). I've found value in this as overall it can minimize database hits. Does ActiveRecord support such a model/pattern? ...
I am trying to convert my custom simple auth system in my rails app to use AuthLogic. I have managed to get everything working fairly easily, but now when I try to login it will not properly validate my credentials. The pertinent code is below: # app/models/profile.rb class Profile < ActiveRecord::Base acts_as_authentic do |c| c.t...
Let's say I used the following command to create a "User" model: script/generate model User username:string This creates the user.rb file along with the migration rb file to create the Users table. Now, I want to add an email column to my User model. What's the best way to do that? Do I do it manually and write the migration file by ha...
I currently have an RoR app in production across four application servers with independent logs per instance. What's the best way to aggregate the logging to a common location without resorting to syslog? ...
I need to keep track of the users lat/lng/city/country for my application with the following two requirements: 1) Get the users lat/lng/city/country automatically. (This is easy, I can use the ip or if they have a browser that supports geolocation, even better). 2) The user is allowed to customize this location (maybe the ip address lo...
I have a has_and_belongs_to_many relationship: class Staff < ActiveRecord::Base has_and_belongs_to_many :services class Service < ActiveRecord::Base has_and_belongs_to_many :staffs and I have a table called 'services_staffs' with columns service_id and staff_id But when I do Services.find(:all) it's not returning the staffs (I ca...
Hi, I have a CommonFunctions Module inside the lib/ folder. I have a Question Model, which includes the CommonFunctions module. Now I am trying to access the favorite function of the CommonFunctions like Question.favorite. But I am getting NoMethodError. I have included the code. Can anyone please tell me where I am doing the mistake E...
Hi, I am page caching a list of products - products.json in the public directory under the rails root. I don't add or delete this data through a controller action. This data is loaded into the database through a data migration script. In the development environment I delete this file from the public directory and restart the mongrel se...
Hi, I am trying to retrieve the class name of an object. When I tried using the const_get, i am getting the entire model's table structure. So I used the following code. Code def classname(object) return object.class.to_s.split("(")[0] end def classrating(object_id) classtype = classname(object_id) return classtype ...