A language-independent collaboratively edited question and answer site for programmers.
I have some question ... example: a user will buy something for his USD Check his USD Balance Deduct the USD from his account Make an Order -> order queue user becomes his item and the other one becomes his USD Lets say, the users makes 5 requests in the same second (very fast). So it...
I wrote my own YAML coder, that takes a default. Here is the class: class JSONColumn def initialize(default={}) @default = default end # this might be the database default and we should plan for empty strings or nils def load(s) s.present? ? JSON.load(s) : @default.clone end # this sh...
I found this very helpful snippet in this thread on the devise google group initializers/some_initializer.rb: Warden::Strategies.add(:custom_strategy_name) do def valid? # code here to check whether to try and authenticate using this strategy; return true/false end def authenticate! #...
I'm creating an e-mail notification in a .text.haml document. How does one denote a blank line? = @variable.name + " , you have a new update." = = = "There has been new activity." In the above example I would like the two lines that have just the haml '=' on them to be blank lines but...
The word "deployment" can have two meanings depending on the context. You are also confusing the roles of Apache/Nginx with the roles of other components. Apache vs Nginx They're both web servers. They can serve static files but - with the right modules - can also serve dynamic web ap...
You're in luck, friend. My first Rails project (7 years ago) was against a horribly set up SQL Server database. Per the above, you need to set up your database.yml appropriately. But for an existing database, obviously it is unlikely that the table and column names conform to the Rail...
I've just created a new amazon Linux instance and installed ruby 1.9.3 and rails 3.2.8. Upon creating a new project I immediately receive failures due to sqlite3. The error is: [root@xxxxx fun]# rails server /usr/local/share/gems/gems/sqlite3-1.3.6/lib/sqlite3.rb:6:in `require': canno...
I read Growing Object-Oriented Software, Guided by Tests by Steve Freeman and Nat Pryce and was impressed very much. I want to adopt the ideas of this book in my Rails projects using RSpec, though its examples are written in Java. A basic precept of this book is that we should mock in...