I am working on a very large Rails application. We initially did not use much inheritance, but we have had some eye opening experiences from a consultant and are looking to refactor some of our models.
We have the following pattern a lot in our application:
class Project << ActiveRecord::Base
has_many :graph_settings
end
class Graph...
Hello,
I have a very strange issue with Daylight Savings Time (DST) in my app. For some reason, whenever I receive a time from the table, it doesn't adjust itself for DST. For example, if I create a new Time in the console, in the appropriate time zone, write it to the database, and then try to retrieve it from the database, it comes ba...
I am trying to configure an application for my client and I am using recaptcha for spam control and I am using ruby on rails (also using this plugin http://github.com/ambethia/recaptcha/).
My client wants an easy challenge as he is not able to read, its too hard. Is there any way I can make the challenge easier?
...
Hi,
I want use always thin when I start my rails server in development mode.
By default it webrick to use. So I add thin in my Gemfile
gem 'thin', :group => 'development'
Now If I want use it to launch my server in development mode I mandatory define it.
bundle exec rails s thin
If I don't define it, it's always use webrick. So H...
I am trying to play with redis on my Ubuntu machine and my little script doesn't work.
I have installed redis gem and tried this little script (I know its pretty small)
require 'redis'
redis = Redis.new
I get this error :
./redis.rb:4: uninitialized constant Redis (NameError)
from redis.rb:2:in `require'
from redis.rb:2
when I com...
I am having a Property model that should contain multiple values (just Strings). With Rails/ActiveRecord it seems that I have to create a new model (and a new table) for those values (like PropertyValue). As every one of those values just stores one String the PropertyValue only need one attribute (like value).
I don't like that idea cau...
I want to make a document management system.
What do profesional sollutions (Alfresco, Liferay social office, others) use for storing and versioning documents?
What else can I use?
Key points:
storage space optimization (deltas, compression ...)
versioning
ability to index docs (can be external)
...
I am happy enough using virtual attributes on a Rails models if they are strings, but I would also like to use other types of attribute, like dates or booleans, so that I can use helpers like date_select to set virtual attributes.
Is there a nice way of doing this?
As it stands, using a date_select helper on a virtual attribute raises:...
I am still new to Rails.
I need to store many (dozens) of booleans in a Rails model (of which thousands will exists in the DB). I came across FlagShihTzu (http://github.com/xing/flag_shih_tzu) that makes it easy to store the booleans in the bits of an integer. (If you know of a better way, please let me know.)
Anyone know if FlagShih...
Hi,
I'm new to Ruby on Rails and I quite like it.
Now I'd like to use a CouchDB as storage database and I don't want to implement new RoR schema but instead I want to use RDF schema.
Is there any possibility to tell RoR(v3) that a schema is be described by such a file (like this one)?
Cheers,
Manuel
PS: If there is no such feature, y...
I have a series of resources that I want only available if accessed via the JS format. Rails' route resources gives me the formats plus the standard HTML. Is there a way to specify that only the JS format routes be created?
...
I'm writing an rspec scenario thats failing with:
(#<User:0x1056904f0>).update_attributes(#<RSpec::Mocks::ArgumentMatchers::AnyArgMatcher:0x105623648>)
expected: 1 time
received: 0 times
users_controller_spec.rb:
describe "Authenticated examples" do
before(:each) do
activate_authlogic
@user = Factory.create(:vali...
Hey guys
There is a lot of demand in my country for rails and hosting, yet there is not one provider that does this. Are there packaged solutions, or at least guides, out there that can help me get started with providing hosting to people?
You can think of it as a local Heroku.com
...
Hi
I send this json to my controller (as seen in my webrick log):
{\"repeatEveryYear\":\"TRUE\",\"scheduleTime\":\"2010-09-09T16:11:46Z\",\"message\":\"Hello World\n\nFirst test\"}
I dont know where all the escaping comes from, it is not something I add, and it seems rails eats it just fine?
My problem is that the second \n gets eat...
i'm trying to have the following structure
get /something/id/apply => controller 1
post /something/id/apply => controller 2
is there an easy way to accomplish this in rails 2.x? right now i'm resorting to manually checking the http method in the controller code, and that seems... fugly.
...
When I run my app I get this error:
config.gem: Unpacked gem rakismet-0.3.6 in vendor/gems has no specification file.
Run 'rake gems:refresh_specs' to fix this.
And when I run:
rake gems:refresh_specs
I get:
No Rakefile found
I've tried the rake command from various directories within the application hierarchy with no success....
First of all, it doesn't seem that the DateTime format variables are documented anywhere so a +1 to anyone who can show this to me in rubydocs. Second of all, when looking at the Date.strftime function code, I don't see anything that can let me do something like:
Thursday, September 9th 2010
Does anyone know if this is possible?
...
Hi
I have a model like this:
class Schedules < ActiveRecord::Base
validates_presence_of :scheduleTime
end
I do not have a view, as my controller only works as a JSON talking webservice, but I would like to "catch" what ever validations errors (there will be more validations in the future) from the model in the controller, and retur...
I am new to Rails. I came from a Codeigniter background. I am having a hard time finding resources on Rails 3.0 for beginners. I read my new Rails book but am still confused about a few things.
How do I include my libraries or helpers into a controller? Do I use an "include" or "require"?
The 2nd question is how do I dynamically load p...
Hi,
If I have two models. Model1 belongs_to Model2, and Model2 has_one Model1. Thus I can access Model2 from Model1 as well as Model1 from Model2. Now my question is, can I change the relationship to Model2 belongs_to Model1 and Model1 has_one Model2? It also can let me traverse from Model1 to Model2 and from Model2 to Model1. I'm not s...