Hey there folks!
Im using merb, and getting weird variable in url after authentication. I figured out that variable contains base64 encoded data, but cannot understand why its appearing there, even if everything works ok. Just curious
It looks like this: http://foo.bar/?_message=....data....
What this variable for and what does it do ?...
Hey, I'm having trouble with the time portion of the Calendar Date Select gem. The following code limits the date to any day after/greater than today. I need to do this for time, limiting the user to a time that is 24 hours or greater than from now. I can't figure out if the code used in the :valid_date_check is SQL, or Javascript or wha...
I am trying to use a Rake task to migrate some legacy data from MS Access to MySQL. I'm working on Windows XP, using Ruby 1.8.6.
I have the encoding for Rails set as "utf8" in database.yml.
Also, the default character set for MySQL is utf8.
99% of the data is coming in fine, but every now and then I'll get a column value that gives me...
How do you write a switch statement in Ruby?
...
Here's a simple Ruby script:
puts `ls -laG`
In OS X's ls, -G is for color.
When run under bash, I get color output. When the above is run from a Ruby script, I don't see color or the ANSI escape sequences in the resulting output.
From what I've read, my guess is it's because the script isn't running as a tty. Is there some way to ru...
In ruby, how accurate is File.atime / File.ctime / File.mtime ? Is it to the nearest second on both Unix and Windows?
...
Can anyone suggest a modification of mode-compile.el that will make it work better on Windows? My specific issue is handling of path names that contain blanks. I'm working on code in Ruby, using "GNU Emacs 22.2.1 (i386-mingw-nt5.1.2600) of 2008-03-26 on RELEASE" with mode-compile.el version: 2.29 (Last modified: 2006/12/01 13:52:47)
T...
I'm trying to do a query like this:
Widget.find(:all, :conditions => ["name like %awesome%"])
However, I'm getting a "malformed format string" exception from sanitize_sql, specifying the "%" as the problem.
How can I perform this query?
...
It seems to me like Ruby has a lot of syntactic flexibility, and many things may be written in several ways.
Are there any language features/syntactic sugar/coding conventions that you avoid as a Ruby programmer for clarity? I am asking about things that you choose not to use on purpose, not stuff you still have to learn.
If your answ...
Sorry if this problem might be a little too specific. I'm a RoR newbie still.
I'm currently modifying an RoR app based on the Insoshi framework on windows vista. It uses Free Image and the image_science gem along with attachment _fu for uploading images to the application and resizing it. Every part of the application seems to be up and...
Hello,
can somebody explain me, how to do wizard-style forms with validations?
f.e.:
i have a appointment-model, which should include following data:
name, starttime, endtime, address, city.
Now i want to have 3 actions for each datagroup:
name
start and enddate
address-fields
each of them should be accessible
(so AASM isn't a...
I want to develop an application with simple Quiz-like games (think of a question , answer, a timer, high-scores/ranking, not much more)
For that I want to use Rails and some javascript library that let me have some modern effects on the GUI (being a GUI the least you can ask is for an atractive interface)
I first considered ExtJS but ...
I have some XHTML (but really any XML will do) like this:
<h1>
Hello<span class='punctuation'>,</span>
<span class='noun'>World<span class='punctuation'>!</span>
</h1>
How do I get the full content of the <h1/> as a String in Ruby? As in:
assert_equal "Hello, World!", h1_node.some_method_that_aggregates_all_content
Do any of t...
When creating an ActiveRecord in rspec, I use fixtures for valid records.
But when using the fxitures in tests, they seem to fail validation.
In the following example, the employee seems to be perfectly valid, and yet the associated validation in the spec says they are invalid.
class Employee < ActiveRecord::Base
validates_presence_o...
I want to extract the files within a ZIP file I uploaded to my Rails app. The files within the ZIP file are going to be stored in the database.
I want to open the ZIP file in my action, without first having to save the file to a folder - I want to open the multipart/form-data stream with rubyzip.
It looks like rubyzip's ZipFile.open on...
I have a question about using attr_accessible in Rails.
I sometimes want to set guard_protected_attributes to false in order to bypass mass assignment protection. I'm wondering why the following line doesn't work (it creates the "can't stringify keys" error):
@user.attributes=({ :name => "James Bond", :admin => true }, false)
...but ...
I'm migrating some data from MS Access 2003 to MySQL 5.0 using Ruby 1.8.6 on Windows XP (writing a Rake task to do this).
Turns out the Windows string data is encoded as windows-1252 and Rails and MySQL are both assuming utf-8 input so some of the characters, such as apostrophes, are getting mangled. They wind up as "a"s with an accent ...
I'd like to add a column to a table using a migration. Is there a way to add it in a particular position, rather than as the last column? I could find any "order" option in the API docs.
...
I am using single table inheritance in my project. Instead of explaining more, I'll give the code:
# person_profile.rb
class PersonProfile < ActiveRecord::Base
belongs_to :Person
end
# company_profile.rb
class CompanyProfile < ActiveRecord::Base
belongs_to :Company
end
# person.rb
class Person < User
has_one :PersonProfile
end
...
Hello,
I am trying to DRY up my code a bit so I am writing a method to defer or delegate certain methods to a different object, but only if it exists. Here is the basic idea: I have Shipment < AbstractShipment which could have a Reroute < AbstractShipment. Either a Shipment or it's Reroute can have a Delivery (or deliveries), but not bo...