Best Permalinking for Rails
What do you think is the best way to create SEO friendly URLs (dynamically) in Rails? ...
What do you think is the best way to create SEO friendly URLs (dynamically) in Rails? ...
I would like my JSON output in Ruby on Rails to be "pretty" or nicely formatted. Right now, I call the to_json method and my JSON is all on one line. At times this can be difficult to see if there is a problem in the JSON output stream. Is there way to configure or a method to make my JSON "pretty" or nicely formatted in RoR? Thanks....
Given a moderately complex XML structure (dozens of elements, hundreds of attributes) with no XSD and a desire to create an object model, what's an elegant way to avoid writing boilerplate from_xml() and to_xml() methods? For instance, given: <Foo bar="1"><Bat baz="blah"/></Foo> How do I avoid writing endless sequences of: class Fo...
Running something like: @users = User.find(:first, :select => "name, lastname, salary") for @user in @users do @user.salary = 100000 @user.save end After this looking up in the Mysql table, the users aren't updated. ...
I'd like to add some pie, bar and scatter charts to my Ruby on Rails web application. I want want them to be atractive, easy to add and not introduce much overhead. What charting solution would you recommend? What are its drawbacks (requires Javascript, Flash, expensive, etc)? ...
I just saw the hilarious "The Rise and Fall of Twitter" which made me think: if you reimplemented twitter, what would you do differently? What technologies would you use? What languages? How do you ensure that the service is scalable? What else would you change? ...
I'm currently using the following to generate an 8 character pseudo random upper case string [A-Z] value = ""; 8.times{value << (65 + rand(25)).chr} but it looks junky, and since it isn't a single statement it can't be passed as an argument. To get a mixed case string [a-zA-Z] I further hack into it with value = ""; 8.times{value <<...
I've been coding alot of web-stuff all my life, rails lately. And i can always find a website to code, but i'm kind of bored with it. Been taking alot of courses of Java and C lately so i've become a bit interested in desktop application programming. Problem: I can't for the life of me think of a thing to code for desktop. I just can't ...
I've been looking at ways people test their apps in order decide where to do caching or apply some extra engineering effort, and so far httperf and a simple sesslog have been quite helpful. What tools and tricks did you apply on your projects? ...
I was following along with the railscast regarding the restful_authentication plugin. He recommended running the command: script/generate authenticated user session Which I did, and everything generated "fine", but then sessions wouldn't work. Checking the site again, he mentions a naming standard and listed updated code which stated:...
I want to set something up so that if an Account within my app is disabled, I want all requests to be redirected to a "disabled" message. I've set this up in my ApplicationController: class ApplicationController < ActionController::Base before_filter :check_account def check_account redirect_to :controller => "main", :action =...
I am a PHP dev looking to pickup a new language, I have tried and failed on C++ several times (possibly for my overall lack of interest). I've been hearing a lot about Python, and Ruby and my question is this: Which of these languages (Python, Ruby) should be easiest for someone with a background in PHP to learn? Update (6 months later)...
I would like to pass an argument(s) to a method being defined using define_method, how would I do that? ...
I have three models: class ReleaseItem < ActiveRecord::Base has_many :pack_release_items has_one :pack, :through => :pack_release_items end class Pack < ActiveRecord::Base has_many :pack_release_items has_many :release_items, :through=>:pack_release_items end class PackReleaseItem < ActiveRecord::Base belongs_to :pack belo...
Anyone got a working example of using ruby to post to a presigned URL on s3 ...
Hi all I have recently installed Ruby on Rails on my new Ubuntu machine (first time for me) and i was working through a demonstration on setting up a sample blog. Basically, i came to the part of setting up the mysql database and would rather use a visual MySQL tool to do this rather than command line. What is best to use? and how do ...
Hi I have a migration that runs an SQL script to create a new Postgres schema. When creating a new database in Postgres by default it creates a schema called 'public', which is the main schema we use. The migration to create the new database schema seems to be working fine, however the problem occurs after the migration has run, when ra...
Hi All, Could any one recommended an open source library that allows me add XMP metadata to JPEG images? Thanks. ...
I'm interested in learning a web framework. The two big ones, as I gather, are Rails and Django. Which one is better/faster? Is one better designed or more logically consistent than the other? Is there another framework I should look into? How easy is it to set up and administer a Rails or Django server, and how easy is it to find a shar...
In IntelliJ when editing Java files, this works for me. e.g. CTRL-LEFTCLICK on an identifier takes me to where that identifier is defined. For some reason it doesn't work when editing Ruby code. Any ideas? ...