Oh so please bear with me... I have a model for bookings and a model for drivers. A driver has many bookings and a booking belongs to a driver.
When adding or editing a booking, I want the user to be able to type the username of the driver. Usernames are unique and easier for the end user than giving each driver a number.
Now this is h...
Hi chaps,
I'm trying to upload a file to the server using a HTTP multipart form in rails, and for some reason it's turning up blank at the other end. I can see it being received in the rails log thusly:
Processing Admin::HeadlinesController#update (for 127.0.0.1 at 2010-03-08 12:26:13) [PUT]
Parameters: {"commit"=>"Save changes", "act...
Hello Friends,
there was a web application, that you could configure so that
over the api, your app could post the error logs into that
application.
it was a paid service and the free version allowed you to do like
1 report a minute.
if any of you remember this service, please post it as an answer.
thank you :)
...
I started using bundler (which is to my eyes a pure disaster).
Now I want to add the Googlebase-gem to my app. So I entered "bundler install googlebase" in the root of my app. Bundler in fact installs several gems, but not Googlebase.
What have I done wrong?
...
Hey Guys
I am trying to create a car application, each car belongs to a make and model, but only certain makes have certain models.
So I would like a series of select boxes that are populated dynamically based on the previous, however I also would like to add another record to that select box if you cant find the one you want.
I would...
Let's say I have a big spec file with 20 tests because I'm testing a large model and I had no other way of doing it :
describe Blah
it "should do X" do ... end
it "should do Y" do ... end
...
it "should do Z" do ... end
end
Running a single file is faster than running the whole test suite, but it's still pretty long. Is there ...
I am working on porting a Rails app to JRuby and HSQLDB. My goal is to embed a database and the site within a single JAR file for deployment at customer sites. I have the site working quite well from the JAR, with a few notable problems.
When I do the following with a pretty mundane ActiveRecord model:
@total = SessionLog.count(:id)
...
I've a controller :platform here.
I'm trying to do something like:
/:platform_name/ to redirect to its show, with the parameter. Here is what I've got:
map.resource :platform,
:as => ':platform_name',
:platform_name => /pc|ps2|ps3|wii|ds|psp|xbox-360/
It's working fine. I've other neasted resources to i...
Hi,
it's about RMagick with Ruby On Rails.
I do the following:
image = params[:image]
# params[:image] is the image from the file-form.
name = image.original_filename.scan(/[^\/\\]+/).last
name = dir + t.day.to_s + t.month.to_s + t.year.to_s + t.hour.to_s + t.min.to_s + t.sec.to_s + name
f = File.new(name, "wb")
f.write im...
I am trying to access the constant VALID_FIND_OPTIONS defined in ActiveRecord::Base (active_record/base.rb Line 2402 Rails 2.3.5).
ActiveRecord::Base::VALID_FIND_OPTIONS
I get the NameError exception.
NameError: uninitialized constant ActiveRecord::Base::VALID_FIND_OPTIONS
I have accessed the class constants in other libraries usin...
I'm planning to work on a web application of reasonable complexity and am wondering what technology to go with. It will probably start with one person, but there will be 2 or 3 more eventually. My first requirement is to be able to do this as quickly as possible - preferably with as less code as possible. Secondly requirement is that it ...
By default, the datetime field from the database is being converted and stripping off the milliseconds:
some_datetime => "2009-11-11T02:19:36Z"
attribute_before_type_cast('some_datetime') => "2009-11-11 02:19:36.145"
If I try to overrride the accessor for this attribute like;
def some_datetime
attribute_before_type_cast('some_datet...
hi all,
I am trying to install ruby on rails in my own intranet, I don't have an internet connection. There are several tutorials out there that try to explain how to do so, but they don't seem to work. Does anyone know of a full installation (including ruby, rails, IDE) that doesn't demand downloading files from the internet?
Thanks ...
If a model changes an attribute locally, then changes it back, ActiveRecord doesn't send the change to the DB. This is great for performance, but if something else changes the database, and I want to revert it to the original value, the change doesn't take:
model = Model.find(1)
model.update_attribute(:a, 1) # start it off at 1
# some ...
Okay this has been lingering in my head for quite a while now.
In ruby on rails unit testing there is an exclamation mark with the assert method. Here is an example
test "No empty values to be inserted" do
product = Produce.new
assert !product.save
end
Let me know the function of the exclamation mark. Quick replies appreciated...
Hi!
This is my code:
class Friend < ActiveRecord::Base
belongs_to :user
belongs_to :friend, :class_name => "User", :foreign_key => "friend_id"
end
class User < ActiveRecord::Base
#...
has_many :friends
has_many :users, :through => :friends
#...
end
When I now start adding users by...
user.users << user2
user.save
Only...
I'm using rfacebook gem to interact with facebook connect. And I'm having a problem with uploading images. As facebook api says, the data should be transferred in a hash like json object. So I'm making an hash
publish_values = {
:uid => @post.profile.channel_uid,
:message => @post.content,
:auto_publish => ...
I have an application configured with authlogic and authlogic_facebook_connect, but every time I click to "Connect" button, my UserSession fails validation, saying "You did not provide any details for authentication"
Isn't the authlogic_facebook_connect supposed to bypass login/password authentication? Am I missing some configuration st...
Let me start by saying I have never deployed a Rails app before.
I have a domain with a main site ran by PHP, let's call it http://www.example.com/.
I have began developing for Rails recently, and I'd like to host the new application I created on http://www.example.com/myapp while still keeping the original site intact.
The main site i...
Hi everyone,
I've been struggling on this thing for a week without being able to find what I'm looking for.
Here is what I'd like to do:
I'm setting up a wiki where I can post all my knowledge to (yes, I know a couple things :p) but I can't render it the way I'd like to.
The bodies of my posts are text fields. In order to render them t...