Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Ruby on Rails is an open-source web development framework written in Ruby. If your question code is written in Ruby on Rails, tag with Ruby as the language tag. Many things are defined by convention, freeing you from having to re-invent things to stay productive.
3
votes
rails method for transaction type
It looks like row is simply a hash, but it has various value combinations that are significant.
You could refactor the detection of those combinations, for example by creating a class based on the ro …
2
votes
Accepted
Open a file, with a fallback path if it doesn't exist at one location
It seems OK to me. You might put the file logic into another method, perhaps, so that #front_matter is only doing one thing?
def front_matter_path
path = Rails.root.join('app', 'components', 'ui', p …
0
votes
Modelling football teams and fixtures in Ruby (as compared to SQL)
I should say that your work might get easier here if you are using an ORM such as ActiveRecord or Squeel or Sequel.
I think that the TeamFixture may be incorrect there.
Fixture feels like an object, …
2
votes
Accepted
Creating a nested treeview Rails
I have a couple of suggestions on the detail, but most of all it seems that most of the code is really in the wrong place, and is quite procedural.
Example: you effectively use description.count("a-z …
1
vote
Accepted
Counting number of messages for a mailbox over several periods
Some suggestions ...
Use a counter cache for messages on Mailbox -- the count of all can be read from the mailbox instance.
Use #size instead of #length. This will use a counter cache for messages o …
1
vote
Accepted
Searching for combinations of words and numbers
I'm not a fan of the latter because the compact and flatten methods create new arrays.
Here's another variation with two additional style options: use of product to combine the two arrays, and each_w …
1
vote
Keep ABC size down for conditional string concatenation in Ruby
Perhaps just extracting the hash lookups would help:
def comment_event_string(comment)
EVENT_TEXT[comment.event.to_sym]
end
def comment_reason_string(comment)
" due to #{REASON_TEXT[comment.reas …