I'm sure this is astonishingly straightforward, and I'm just inexperienced with Rails 3, but I can't figure out how to make it work.
I'm trying to install the paper_trail plugin into my Rails 3 app; but the instructions seem designed for Rails 2. I'm running under Windows, and don't have git available.
I've tried putting gem 'paper_tra...
I'm using Rails3, ActiveRecord
Just wondering how can I chain the scopes with OR statements rather than AND.
e.g.
Person.where(:name => "John").where(:lastname => "Smith")
That normally returns name = 'John' AND lastname = 'Smith', but I'd like:
name = 'John' OR lastname = 'Smith'
...
Hi all,
I am currently caching my web application.
So I was driving to use memcache and i was looking for an easy way to handle all that.
For exemple, i would like to cache all my contents until they are not modified.
And I can't cache all the page because some parts need to be cached apart.
So I could use a fragment_cache for the c...
I've placed the file rack_app.rb with simple Rack application in the lib directory:
class RackApp
def call env
[200, {}, 'Hello']
end
end
Then I've added this route:
match 'rack' => RackApp
And when I try to launch the rails server I get the following error:
config/routes.rb:65: uninitialized constant RackApp (NameError)
...
What is the best way to access a Rails 3 REST-ful web service, developed using standard Active Resource techniques including HTTP authentication over SSL, from a VB.NET consumer?
Consumer can be .NET 4.0 if that is necessary.
Are there any .NET libraries yet that can bridge the gap?
I have already come across links like this (http://...
In a Rails3 app, I want to use resourceful paths for an ActiveModel EntityImage representing image file uploads. In some directory I have these files dir/#{type}/#{id}/#{size}.jpg (which are basically all important fields of that class)
Now, probably, because 'id' is a bad name rails wise (it is not domain wise), when I want to make a d...
I am attempting to create a friend network on a site I am making. I am using Mongoid. How do I instantiate friends?
I assume that Users needs to have a relational association with multiple other users. But the following code:
class User
include Mongoid::Document
references_many :users, :stored_as=>:array, :inverse_of=> :users
en...
I have following models in my app:
class Game < ActiveRecord::Base
has_many :players
has_many :villages, :through => :players
end
class Village < ActiveRecord::Base
belongs_to :player
end
class Player < ActiveRecord::Base
belongs_to :game
has_many :villages
before_create :build_starting_village
protected
def...
Hi guys i have a model livestream which has two columns in the database, 'user_id' and 'activity_id'. Very straight forward.
Now when I try to insert multiple records into the database I get an invalid SQL statement:
SQLite3::SQLException: near ",": syntax error: INSERT INTO livestreams (user_id, activity_id)
VALUES (1, 2), ...
Hello, rails 3 newbie, using Devise for auth...
I want to create the following models:
class Instance < ActiveRecord::Base
has_many :users
has_many :notes
end
class User < ActiveRecord::Base
belongs_to :instance
end
class Note < ActiveRecord::Base
belongs_to :instance
end
To create a new note in the notes_controller.rb
def cr...
Hello, newbie here...
I have the following models:
class Instance < ActiveRecord::Base
has_many :users
has_many :books
end
class User < ActiveRecord::Base
belongs_to :instance
end
class Book < ActiveRecord::Base
belongs_to :instance
end
I now want to add a BookRevision table, that has the following columns
(id, user_i...
Hello, I'm real interested in using Vestal Versions with Rails 3. Does anyone know if Rails 3 works with Vestal Versions? I've heard some users are running into issue:
ActiveRecord::DangerousAttributeError: changes is defined by
ActiveRecord" It uses a field in the model called changes. Not sure if
there are plans to fix that or not.
...
Hi, I did something while trying to install the vestal_versions plug-in that ended up creating a vestal_versions directory in my app's root with the following:
- Application
- APP
- DB
- vestal_versions
- ruby
- 1.8
- bin
- cache
- doc
- gems
- specifications
Which if deleted prevents the...
I am trying to install the mogli gem( http://github.com/mmangino/mogli ) on rails 3 and am running into problems with the configuration. I have NO prior experience with Rails 2.
For Rails 2
Add config.gem "mogli" to environment.rb
For Rails 3, I added the following to the gemfile.
gem 'mogli'
For Rails 2, routes
map.resource :...
Hello, I'm using Rails 3 with devise.
I have a table books which has a column for user_id, which is related to the Users table (user.rb)
I'm trying to create a Scope that shows all the books with the user's email address (Books joined to Users)
class Note < ActiveRecord::Base
scope :personal, proc {|user| where(:user_id => user.id) }...
Hi all,
I'm creating a new Rails 3 app,
and in it I use datetime for a couple of fields,
however every datetime field standard has UTC behind it (in a view), like:
2010-10-10 16:19:00 UTC
How do I get rid of the UTC part?
UPDATE: here's what I have so far:
<%= trip.truckleft.strftime("%Y-%m-%d %H:%M") %>
So all I have to do now...
Hi,
I'm using the Vestal Version Fork here for Rails 3 support: http://github.com/adamcooper/vestal_versions/
The issue I'm having is that the updated_by => current_user is not storing in the versions table on update.
def update
@book = Book.find(params[:id])
respond_to do |format|
if @book.update_attributes(params[:...
I was hoping someone would spot why this wouldn't work.
I am getting an error thats being called because the attributes I specify with Factory_Girl are not being applied to the stub before validation.
The Error:
undefined method `downcase' for #<Category:0x1056f2f60>
RSpec2
it "should vote up" do
@mock_vote = Factory.create(:vote...
I have a rails 3 application very similar to the one in Railscasts episode #229 the only difference is that in my code Articles is called Posts and I have a nested route:
routes.rb:
Myapp::Application.routes.draw do
resources :posts do
resources :comments
end
root :to => "tags#index"
end
I receive this error in the terminal...
I am new to Rails but have used PHP extensively over the years. I am building a simple blog (I know) to get my skills up in the MVC/Rails world.
I have the basics working but have spent the weekend trying to get Maruku to work eg a post body saved from a text area with Markdown Extra markup to the db and then back again to the browser.
...