If I were to implement a system identical to the StackOverflow question revision history using Ruby on Rails, what would I need to do in order to achieve that? I am creating a site that acts like a wiki where user contributed content can be updated by other people. I need to be able to track the history of these changes, but I am not fam...
I would like to define a custom logger for my Rails 3 app, in a way that it does not replace the original logger (I still make use of its information).
I assumed that I could define in a lib a class that inherited BufferedLogger as I've seen on some blogs. Then I would instantiate a variable to represent my logger, on the end of my appl...
So there's this great plugin I've gotten used to using in my Rails 2 projects called Bootstrapper. It essentially duplicates the functionality of the seeds.rb file, but I like it because it lets you break up your bootstrap process into concise chunks.
Anyway, I've gone so far as to fork the project and attempt to turn it into a Rails 3 ...
Hello, I'm looking to learn how to serialize data in Rails 3...
Things I'd like to learn:
A. What serialized data looks like (example for photo_id: 123123, photo_name: "Blah)
B. How to serialize data in Rails 3
C. How to extract serialized data to do something like mydate.photo_id given the above.
Thanks!
...
I'm creating an AuditLog observer that watches over several models.
I'd like the observer to have an after_create, which creates a JSON object that is stored in a database column. It will contain data like {photoid:123, photoname: "asdasd", creator_id: "asdasd"} etc...
In Rails, how do I create this type of JSON object and then how do ...
I'm experimenting with s3 but im running into a permission problem (i think).
Output:
AWS::S3::PermanentRedirect in CkeditorController#create
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
I'm using ckeditor. My Ckeditor::Picture class includ...
Hi! I have the following Observer:
class NewsFeedObserver < ActiveRecord::Observer
observe :photo, :comment
def after_create(record)
end
end
What'd I'd like to learn how to do is add a SWITCH/IF statement in the after_create, so I know which model was created
Something like:
after_create(record)
switch model_type
case "photo"...
Hello, Im building a Rails 3 app, and have an Observer...
in the observer I need to user the current_user var that DEVISE allows me to user across my views...
How can you use the current_user.name or current_user.id in the Observer?
Thank you
...
I would like to test a controller that directly renders some JSON output (by using "render :json => @entity_names"). For that task I tried in my spec file "response.should have_text('["enim", "enita"]')". Unfortunately I always get that error:
Failure/Error: response.should have_text('["enim", "enita"]')
undefined method `has_text?' for ...
I have a form for @profile (controller = profile#new). Inside this form are nested fields for generating an @user (I'm using Devise for user authentification).
If a profile were to be generated without a user this causes lots of issues in the system so I want to set up a validation ensuring that a profile cannot be created without a u...
Hey folks,
I have following models:
class App::Module::Object < AR::Base
has_many :objects, :class_name => 'App::OtherModule::Object'
end
and
class App::OtherModule::Object < AR::Base
belongs_to :object, :class_name => 'App::Module::Object'
end
Using Rails 3.0.0 and Ruby 1.9.2, I get following error after accessing App::Module...
Hello, i have table AuditLog with fields including: audited_id | audited_type
That results in data like:
108 | Photo
303 | Comment
What I want to do is create a link to the item, so for the example above:
here is the photo
I'm trying to use a polymorphic_path but am getting an error: "undefined method `model_name' for Fixnum:Class"
...
I think the build in editor isn't really that great and I think about changing it into something different.
Is there any complete solution with one of the rich javascript editors available? Basicly it should be fairly easy to replace the editor with something else, as it just generates html. One thing which can a bit more difficult is r...
I have a resource called products and I believe it should create url helpers for products_path ("/products") and product_path ("/products/1"). While I get the first one, I cannot use the second. The error message says:
No route matches {:controller=>"products", :action=>"destroy"}
It appears to think I want to use the destroy actio...
I'm using the same layout for several controllers, and inside this layout I include a menu using a call to a helper, like this:
<%= side_menu %>
What I'd like to do is vary the contents of side_menu depending on the controller that's invoking the layout. In an ideal world, I could define side_menu in application_controller.rb and in ...
I just installed Rails, etc. on a Windows 7 machine.
Created my first app, and am trying to go to the first generated and this is what I get:
Routing Error
No route matches "/say/hello"
Where say is the app name, and hello is the name of the first view.
Thoughts?
...
I have an issue with routes when i use this partial
partial search
<% form_tag search_path %>
textfield
submitbutton
<% end %>
Then inside of my main index, i call the
render 'partial'
then when i try to use the text field i get a routing problem but in my routes i have
match 'search' => 'dashboard#search'
... Any he...
Hello, I'm working to install Rails 3 on a new MacBook Pro...
when trying to get my app going, I get the following error:
Could not find bcrypt-ruby-2.1.2 in any of the sources
Try running `bundle install`.
When I run bundle install, I get the following:
...
Installing bcrypt-ruby (2.1.2) with native extensions /Library/Ruby/Site/...
Are there any particular rails user authentication gems or plugins that are well-suited for multiple user types?
...
I had a dropdown. I need to add a textbox when the value changes in the dropdown. I had done this using "obseve_field" tag in rails 2.3.5. Now I am moving into rails 3. So how I write it in rails 3.
...