Hi,
I have a has and belongs to many relation between User and Article
models, and I would like to link them even if an article if not hosted
on the same database then a user.
For example, If an article exists at foo.com/articles/3 and a
user exists at bar.com/users/1, If would like to be able to do
from foo.com web interface or bar.co...
So I'm going around in circles with this - I'm using a fork of the Paperclip Rails gem to get it to work with Rails3. Works fine on my OSX box with Passenger. But on my server (CentOS 5) I get this this error:
git://github.com/lmumar/paperclip.git (at rails3) is not checked out. Please runbundle install(Bundler::PathError)Blockquote
I...
Having never worked with Ruby on Rails, I looked it up on Wikipedia. It says
It is intended to be used with an
Agile development methodology that is
used by web developers for rapid
development.
This got me asking how a given language/framework can be more appropriate for given development methodologies. Are there certain la...
I'm using the Facebook JS SDK for single-sign with my rails app. I translated the php code from the Facebook example (at the bottom of the page under "Single Sign-on with the JavaScript SDK") into ruby.
This appeared to be working great but I've noticed one user that gets continual redirects when trying to login. The logs look like:
Pr...
I have a User model.
I have a Session controller, in which I have a global user variable that is assigned as follows:
$user = User.authenticate(params[:session][:email], params[:session][:password])
(I've made user global just to try to solve this problem, so if there's a better way please let me know!)
I need to use the email of th...
I basically want to autodetect a user's timezone using Rails. I can use this JS code at the user's browser (http://www.onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/) to send a form with the UTC offset and the fact that the time zone observes DST during summer or not, in the user's time zone.
Once I have that info ...
Hi there,
my rails applications (all 2.3.5) use a total mix of inline javascript, rjs, prototype and jquery. Let's call it learning or growing pains. Lately i have been more and more infatuated with unobtrusive javascript. It makes your html clean, in the same way css cleaned it up.
But most examples i have seen are small examples, an...
I am trying to test facebook api calls with cucumber. Here is the code.
# app/controller/facebook_users_controller.rb
class FacebookUsersController < ApplicationController
def create
fb_user = facebook_session.user
user = User.new(:facebook_uid => fb_user.uid, :facebook_session_key => facebook_session.session_key
respond...
I'm wondering what I would do to go about letting a guest use my web application without registering, then if they attempt to save their work they are prompted with a registration. This will be in a rails application by the way. Can I just allow public access to part of the work flow, then when they save check if they're a registered use...
Linking to external file in Ruby on Rails
I have a file I want to share as a link in my rails app.
I create a link to it in the .erb file like this
<li><a href="somefile.pdf">Some File</a> </li>
When I select the link I get the following error.
Routing Error
No route matches "/pages/somefile.pdf"
with {:method=>:get}
Do ...
I have a standard contacts_controller.rb with index action that responds as follows:
respond_to do |format|
format.html
format.xml { render :xml => @contacts }
end
In development, it works as intended: when I browse to http://localhost:3000/contacts, I get an html response.
But, when I start the app using capistrano on a remot...
On Ruby on Rails, say, if the Actor model object is Tom Hanks, and the "has_many" fans is 20,000 Fan objects, then
actor.fans
gives an Array with 20,000 elements. Probably, the elements are not pre-populated with values? Otherwise, getting each Actor object from the DB can be extremely time consuming.
So it is on a "need to know" b...
Hi all,
I'm looking to implement preview functionality in my posts scaffold. All I need to do is allow a user to enter information in the new view (/posts/new) and then replace the submit button with a preview button.
Once the preview button is clicked, the user is routed to the preview page (probably /posts/new/preview). If the user w...
Hi have a model like this:
class EventDate < ActiveRecord::Base
belongs_to :event
named_scope :named, lambda { | name | {
:joins => { :event => :core},
:conditions => ["name like ?", "%#{ name }%"]
}}
named_scope :date_range, lambda { | start, length | {
:conditions => ["day >= ? AND day <= ?", start, date + (lengt...
I need to model Owners and Rentees in an application, so you have stuff that is always owned by someone and can be rented for someone else. I first approached this problem with Single Table Inheritance because both types of person will share all attributes, so you would have a model called Person associated to a table people with Owner a...
Hello i guess this is going to be pretty noob question.. But..
I have an scaffold called list, which has_many :wishes. And with that information in my model, I can in my list view use this code
<%=h @list.wishes.count %>
well now I have made an controller called statusboard..
And in that' I have 3 functions.. Or how to say it.. b...
I'm new to MongoDB and I've used RDBMS for years.
Anyway, let's say I have the following collections:
Realtors
many :bookmarks
key :name
Houses
key :address, String
key :bathrooms, Integer
Properties
key :address, String
key :landtype, String
Bookmark
key :notes
I want a Realtor to be able to bookmark a House and/or a ...
In my Rails app I have a fairly standard has_many relationship between two entities. A Foo has zero or more Bars; a Bar belongs to exactly one Foo. Both Foo and Bar are identified by a single integer ID value. These values are unique across all of their respective instances.
Bar is existence dependent on Foo: it makes no sense to have a...
can you update your 2.3.5 app with just "gem update rails" and change the version # in environment.rb? I did that and lots of errors came out like in console just typing Post.all would show "undefined method `retrieve_connection' for nil:NilClass". Any ideas?
By the way, I have these gems in my environment.rb
config.gem "aws-s3", :vers...
Student.find(:all, :conditions => [‘name = ? and status = ?’ ‘mohit’, 1])
Vs
Student.find_all_by_name_and_status(‘mohit’, 1)
Both the queries will result the same set of row but first one is preferable cause in the second way there will be exception generated method_missing and then rails will try to relate it as dynamic method. if ...