I've found myself twice in this situation: I install a gem on my system and start using it from my Rails project. Eventually I need to make some changes to that gem. How should I proceed?
Ideally I'd like to check out the source code of that gem somewhere, like ~/third_party/gems, work on it and have my Rails project use that instead. I...
Let's say I have a Rails application deployed on Heroku. How can I display these pieces of information in my views?
The Git hash for the last revision
The Timestamp for the last revision
...
Hi, I'm trying to get RoR running on bluehost. I followed a tutorial to get started, and I thought it worked fine when the default page showed up, only to find that if I delete index.html from /public the directory listing is showing instead of the application.
I use mercurial to version control this onto the server (probably doesn't ma...
I have a rails form with 2 selects where one of them depends on the the selected value of the other. So if I have 3 users and 5 items per user, once a user is selected I want the items selection to contain only the items specific to that user. Sounds pretty straightforward but I'm having a very difficult time getting this working. Her...
I need to use the nifty_scaffold to generate all the views and controller for my model, but I already have the model, the migration and the table in database, so I don't need it to generate the migrations. The problem is that when it founds an old migration, it says
Another migration is already named your_table: db/migrate/2009090421220...
I'm looking for advice on the current best forum/community/bulletin board system written in Rails for integration into an existing Rails app.
I'm also open to non-Rails forums that can be integrated with my Rails app & authentication without too much trouble.
Any advice?
I did a bit of research and found answers from more than a yea...
Hello, I've been writing desktop apps in C# for some time now but I'm increasingly getting frustrated with the fact that not everyone has .NET 2 or Higher installed. I don't have the option of upgrading their systems to meet my needs. My apps are mostly utilities that run alongside the main program the company I work for has. They access...
The newer style of eager loading uses multiple queries to load associations. Is it possible to add conditions to those additional eager loading queries? e.g.
Bakery.find(:all, :include => :bakers)
will generate an eager loading query similar to this:
SELECT bakers.* FROM bakers WHERE (bakers.bakery_id IN (1,2,3,4,5))
Is it possible t...
I'm using a transparent PNG with the Google IE fix library. This fix only works on images urls that end in "-trans.png".
Rails' timestamp-based caching is causing problems with this. When I use image_path() to generate the URL for the image, it appends the file's last-modified timestamp to the image's query string. Since the URL no long...
I know I can use the ActionView helper strip_tags method in my views to sanitize output, but what is the best way to sanitize user input before I persist it to my db? Should I find a way to include the view helper in my controller and reuse the strip_tags method? I thought rails would have something available globally to do something l...
I'm trying to pass a byte array from inside my rails app into another ruby script (still inside my rails app), for example:
`./app/animations/fade.sh "\x01\x01\x04\x00" &`
Yields ArgumentError (string contains null byte)
I suppose I'm stumped with how I can form this string and than pass it to my script, which will use it in this sor...
I have a working RoR application, I want to insert some Java code into it. What is the best option for me ?
...
I have a query which searches two separate fields in the same table... looking for locations which are most likely a specific city, but could also be a country... ie the need for two fields.
Table looks like:
Country City
Germany Aachen
USA Amarillo
USA Austin
Result:
Keyword Sideinfo
Aachen Germany
USA ...
A predefined set of objects has to be aggregated into a new object. However I want the users to specify a custom function for that.
Now the naive approach would be
def foo; end
objects = [1,2,3]
# result = eval(user_script)
result = eval("objects.inject {|sum, n| sum + n }")
What I obviously do not want to do! I read about $SAFE = 4...
I'm having problem with my Rails application. I use juggernaut for server push, which works very nice in Firefox, Opera and Chrome, but it doesn't work at all in IE. It should be compatible with IE6+.
The problem is, that I can't find any debugging tools that can monitor network as Firebug does in Firefox. I tried IE debug bar, but ther...
In rails, page templates have their own controller which is called before a page is rendered (I think?).
Likewise, can I have a controller associated with a partial that is called before the partial is rendered?
I know you can pass local variable into a partial, but I want to run a good few lines of code to assign those local variable...
I am using the typeWatch plugin to monitor a text field and I want to send a callback to a controller to then replace a divin the view. The event is hitting the controller but I cannot seem to get the div to update the contents:
$(function() {
$("#start_date").typeWatch( { highlight: true, callback: finished } );
function finished...
i m using rails 2.3.3 and web browser Firefox i have added ajax and java script and it is working too but i have to reload the page every time when i press Add to Cart button to show item additionn in the side bar it don’t show it without reloading.
anyone please help me how can it show item addition in side bar when i press Add to Cart...
Is it possible to create primary key without auto_increment flag in ActiveRecord?
I can't do
create table :blah, :id => false
because I want to have primary key index on the column. I looked up documentation but didn't find anything useful.
Is it possible to create primary key without auto_increment?
...
In Ruby on Rails, I have an update method in a controller, that is being called by both ordinary HTTP requests and AJAX requests from many different pages.
For example, a user might just use that controller's edit page, which submits to update by either ordinary HTTP or AJAX, depending on if the user has JS. On the other hand, the user ...