I have 4 classes - Patient, Doctor, Person, and Appointment. Patient and Doctor are subclasses of Person. Appointment belongs to Patient and belongs to Doctor.
I want to write an AR statement to sort appointments by the patient's last name and another to sort by the doctor's last name, as all appointments will be in a sortable table. ...
I am trying to deploy a Rails application on Ubuntu 9.04 using Passenger.
As far as I can see, I have everything configured correctly; however when I point my browser at my domain, all I see is the index of the app's public directory.
My hunch is that Passenger is not starting up - at the bottom of just-plain-folks.co.uk there's no ref...
I am a newbie in Ruby On Rails, Can someone tell me how to refresh a page.
Without any values submitted
With previous values submitted
...
Hi,
I'm building my first Rail App and are beginning to setup my database. I have a simpel Users table containg name, e-mail (login), password and so on.
The site lets the users bet each other (with monopoly money), so I need to add information about the users current winnings and other delicate matters to the database.
Question: Sho...
I have found the "pure SQL" answers to this question. Is there a way, in Rails, to reset the id field for a specific table?
Why do I want to do this? Because I have tables with constantly moving data - rarely more than 100 rows, but always different. It is up to 25k now, and there's just no point in that. I intend on using a scheduler in...
I have articles, profiles, and comments. There is a polymorphic association between articles/profiles and comments called commentable.
On success creating a new comment I return to the commentable parent object with a sucess flash and I would like to do the same with the appropriate error flash on validation errors.
What should I pass ...
(using Ruby on Rails and ActiveRecord)
In short: Is there some way how a model can use different DB schema for each request?
Why I need id: I have a working intranet application working for one company but I decided I would like to offer it to other companies. The Rails way would be to add company_id to each model and alway use this sc...
I have a standard restful rails application.
format.html { @users = User.find(:all, :limit => 10)}
format.csv { @users = User.find(:all, :limit => 10) }
When the url is
http://localhost:3000/users.csv
I get a file with name users.csv .
However if the url is
http://localhost:3000/users?format=csv
then the file I get has name use...
Hi,
I'm new at ruby on rails, and I wanted to accomplish the following:
I've got a list with check boxes(one per row) and I'd like to have a link button(not a common button or submit) so when I click it I call an action from a controller.
My questions are:
How can I call a controller action with the link_to?
How do I get the checkbo...
In Rails console: I was wondering if you could list/examine what databases/objects are available to you. Yes I know you can see using other tools, just curious if you can inspect them inside the Rails console.
thanks.
...
routes.rb
map.resources :places do |places|
places.resources :reviews
end
place model
class Place < ActiveRecord::Base
has_many :reviews
end
review model
class Review < ActiveRecord::Base
belongs_to :place
end
In my reviews controller test I have the following assert_redirect_to statement
assert_redirected_to pl...
How do I check a value starting with a decimal
is_a_number(value) .... works for 12, 12.0, 12.2, 0.23 but not .23
Basically I'm doing a validation in a form, and I want to allow values starting with . i.e .23
but obviously pop up a flag (false) when its not a number
...
I am building a site that has a lot in common with a person-on-person chess site. I was thinking of using Rails for the front-end(User Registration, Navigation, etc) and something like Scala or Erlang for the engine(Game state and maybe AI). I was wondering -
Is this a good situation to use that type of design?
How exactly would be be...
Ryan Bates' render-caching gem is nice, but it keys cache entries by request_uris:
def render_with_cache(key = nil, options = nil)
key ||= request.request_uri # <----
body = Rails.cache.read(key)
if body
render :text => body
else
yield if block_given?
render unless performed?
Rails.cache.write(key, response....
I'm working on a web application that uses wysihat to let the user edit a large textarea.
I wanted a WYSIWYG text editor that was easily customized, and one of the customizations I was hoping to make was having a keyboard shortcut (I was thinking command/control + L) turn the current line into a heading. I can add buttons to do this ea...
I have a simple Customer model which has id, firstName, lastName, address_id columns.
In the method I have the following method to add data to the database:
def self.add_customer(firstname, lastname)
@cust = Customer.new(:firstName => firstname, :lastName => lastname, :address_id => self.id)
@cust.save
end
This is giving...
Hi,
Can any one guide me how to enable web services in redmine, specially XML RPC. And a proper way to implement such web service in redmine.
Thanks.
Parthiv
...
I did a find on some model and got the following
>> @addy
=> [#<Address id: 3, street: "Some Street", houseNumber: nil, created_at: "2010-01-20 06:09:52", updated_at: "2010-01-20 06:09:52", address_id: 16>]
Now how do I retrieve the values? what if i want the street?
@addy.street does not work netiher does @addy[:street]
what if i ...
I'm using jQuery to create an inline calendar with my Rails application. To respond to date selections jQuery calls a function in Javascript. In my application, I'm wanting to query the database with the date selected and then update data onscreen based upon the results from the query.
What is the best practice to call a method from the...
How do you merge models so that I can have the last 10 Posts, Feed Entries and Private Messages displayed in order?
Posts are stored in the "Post" model and ordered on "created_at"
Feed Entries are stored in "Planet" and ordered on "published_at"
Private Messages are stored in "Message" and need to be filtered with:
:conditions => "r...