Displaying 20 results from an estimated 4000 matches similar to: "What's the simplest way to use ActiveResource in ruby (without rails)?"
2006 Nov 17
5
configure a rails app for multiple databases
Hello Rails community
I cannot seem to find via Google what I had hoped would be
a simple issue
On a single DB system (currently, postgres 8.1.4),
I have two databases, each containing multiple tables.
I would like to configure my app and database.yml to recognize
these two databases.
What is the corrrect config for the database.yml ?
Is it something like:
> production:
> adapter:
2008 Mar 07
6
creating a model registry
Hi all,
This is a problem I''ve approached so many times and always worked
around, that now I want to solve it once and for all. Say I have
something like this:
---
class X < ActiveRecord::Base
acts_as_wacky
end
module Wackinator
class ControlAllWackos
@@wackos = []
def self.kill_wackos
@@wackos.each(&:kill)
end
end
def acts_as_wacky
2008 Mar 04
3
remote_form_for does not work with method = :get
It seems that remote_form_for does not work with method = :get since
it does not change the prototype call. Is this a bug?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe
2006 Dec 04
7
I need help to connect Postgres and Ruby on Rails Please.
Hello to everyone, I have a problem that is giving me a headache, and
trying to do a project in Ruby on Rails and I need to connect with a
Data Base that is en Postgres, the truth is that I didn’t think that it
was so hard to connect a DB with postgres because I was working with
Msyql and everything was easy. This are the thinks that I have install
in my computer.
1. Debian GNU/Linux, kernel
2008 Feb 23
3
Attachment_fu: how to remove images?
I just used attachment_fu for the first time, and it works quite well.
I have a user-model, and each of them has_one :image (and the images
belongs_to :user). I have a question on this though: how can i remove
images? Whenever i set a new image for a user (a user who already has
an image), then the table with images gets updated correctly, with the
user_id column of the old image set to null, and
2008 Feb 22
12
DRY - in controller or model????
Hello.
I''m trying to make clean efficient code and would like to find out if
there is a "BEST" way to write code. I want this to run quickly and
efficiently for my app.
I''ve got a form that needs a select list created for new and edit
functions. Same list.
Do I do this in the controller and reference @list in the forms?
def new
@list = %w { apple orange banana }
2009 Sep 24
5
Non-ActiveRecord based model being passed as string?
I have a model that looks like this (with various other methods)
class HsdPair
attr_accessor :hsd
def initialize(hsd)
@hsd = hsd
@current_display = 0
@has_changed_flag = false
end
end
After initializing this object in the controller
@hsd_pairs = HsdPair.new(@job.hsd_pairs)
using it in the view various times and in various ways, when I try to
pass this object back to the
2009 Aug 07
4
ActionController::UnknownAction (No action responded to 22.
I try to switch my application from Rails 2.2.2 to Rails 2.3.3.
In namespace :admin I have a resource-based controller. See controller
class Admin::OSystemsController < Admin::BaseController
def index
.......
end
def edit
.........
end
def update
..........
end
end
Resource is added to routes.rb like
map.namespace :admin do |admin|
............
admin.resources :o_systems,
2008 Feb 25
4
Using group in with find in an ActiveRecord appropriately
I''m playing around with the Practical Rails Projects code, and was
attempting to make a change for graphing data differently using
groupings.
Basically the code went from:
total_weight = @exercise.activities.collect {|e| e.repetitions
* e.resistance}
workout_dates = @exercise.activities.collect {|e|
e.workout.date.to_s}
To:
total_weight =
2009 Aug 06
18
Best Practices Question
Should models call action mailers, or should those calls always
originate from controllers? For example, should user.forgot_password
send the email, or should the user_controller.forgot_password?
Just looking for some opinions...
Thanks,
Tom
2008 Feb 29
7
Moving pagination to the Model
I''m using will_paginate in a Post class method;
[code]def self.list(page)
paginate :per_page => 10,
:page => page,
:include => :user
end[/code]
I can happily use the method on my posts controller index action;
[code]
class PostsController < ApplicationController
def index
@posts = Post.list(params[:page])
respond_to do |format|
2006 May 01
5
Adding classes without script\generate
Can I add classes to a rails application manually i.e without using
script generate Model/Controller?
The reason I am asking, I added a class by putting it in the controller
class. I can access the class and its method from command-line (irb),
but when I try to instantiate it in another controller, I get
"uninitialized constant" error.
If I try using script\generate Model
2008 Nov 20
1
My ignorance and Fuse (or glusterfs)
I have a very simple test setup of 2 servers each working as a glusterfs-server and glusterfs-client to the other in an afr capacity.
The gluster-c and gluster-s both start up with no errors and are handshaking properly..
One one server, I get the expected behaviour: I touch a file in the export dir and it magically appears in the others mount point. On the other server however, the file
2007 Jan 03
3
Self-referential habtm with condition is broken
Here''s a simplistic model class.
class Person < ActiveRecord::Base
has_and_belongs_to_many :relatives,
:class_name => ''Person'', :join_table => ''relatives'',
:foreign_key => ''from_id'', :association_foreign_key => ''to_id''
has_and_belongs_to_many :brothers,
:class_name =>
2009 Jun 24
3
ActiveResource:: HttpMock
I''m trying to set up testing on my ActiveResource project. The
HttpMock appears to be what I want, but whenever I use the code in the
"documentation", I get the error
NameError: uninitialized constant ActiveResource::HttpMock
Is there something I need to do to enable HttpMock testing?
Thanks,
Tom
2006 Sep 01
2
Include ActiveResource
Hello,
I want to give ActiveResource a spin.
I have all the code checked out from SVN in vendor/rails (yes, including
ActiveResource).
I''m trying to make sure it gets loaded.
I did this in environment.rb:
config.load_paths += %W( #{RAILS_ROOT}/vendor/rails/activeresource/lib )
Unfortunately I still can''t use it. I have an ActiveResource derived model,
Address:
class
2007 Jun 21
2
does activeresource only work with edge?
hey all,
I''ve just installed the activeresource gem and it wasn''t working, so I
did gem update rails and it worked. But now I have rails-1.2.3.6906
and I think this is edge right? Is there a way to work on regular
rails 1.2.3 with activeresource?
thanx in advance
Pat
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to
2007 Feb 07
5
Mocking ActiveResource
I want to use ActiveResource in my app. Instead of hitting server
though, I want it to load from a file when I call find. Any clue how
I do that?
Pat
2008 Sep 28
4
ActiveResource and InvalidAuthenticityToken exception
Hi,
I have a Rails 2.1.1 web app, and a Rails 2.1.1 app acting as a client
by using ActiveResource.
From the client, I can find, create, and update resources owned by the
web app.
However, I can not delete any. Calling the .destroy method in
ActiveResource generates a 422 from the web app.
Not sure why this would be the case, since I thought
protect_from_forgery only protects HTML and JS
2007 Sep 22
4
ActiveResource, find(1) works but no find(:all)
Hi,
I''m on edge and Fuser.find(1) works but Fuser.find(:all) shows the error
[1]. Fuser is declared here [2]. Do you know what''s happening? Thanks.
[1]
ActiveResource::ServerError: Failed with 500 Internal Server Error
from
/.../vendor/rails/activeresource/lib/active_resource/connection.rb:124:in
`handle_response''
from