Questions tagged "ruby-on-rails" (page No.1)

Ruby has Seemingly Erratic Results from 23+9.23 = 32.230000000000004

I receive very interesting and seemingly erratic results in irb for Ruby. What is going on? This is correct! >> 23+9.22 => 32.22 This is not! >> 23+9.23 => 32.230000000000004 Where are all the trailing zeroes coming from? What is going on? ...

ruby on rails devise :registrable remove return errors

I want to remove the registration page from my rails app since i am going with invitation only system and i have read that i have to remove the :registrable module from my user model in order for my sign up page to disappear... when i do it i get ...

Nested attribute doesn't show up attr_accessible

I have a nested attribute message.rb class Message < ActiveRecord::Base belongs_to :trip attr_accessible :name, :email, :subject, :body end Which belongs trip.rb class Trip < ActiveRecord::Base has_many :messages accepts_nested_attributes_for :messages, :allow_destroy => true ...

Prohibit some words from being saved

ruby 1.9.2p290 rails 3.1.1 I have the following routes output: http://localhost:3001/chefs/peter (shows the chef profile **based on username**) http://localhost:3001/chefs/edit (can edit their profile if logged) How to prevent user to create a username that already has a action name like edit? ...

how to overwrite rails engine files that are in the lib directory?

I want to overwrite a file of a rails engine, but that file is in that engine's lib/rails directory. When I take the same file and drop it in my lib/rails directory it doesn't overwrite the file. Seems like rails handles the lib directory differently than say files ...

Recommended development framework and DB for web app with the following characteristics

I will shortly be looking for a technical partner to build my business to business productivity tool but want to ensure we are using the right framework to ensure a great user experience. I have researched myself but I am still really not sure what kind of framework best ...

rails asset pipeline asset group not precompiling datatables

I started building a rails project that uses jquery-datatables-rails. When I put that into my Gemfile I did NOT put it into the assets group. Everything worked fine in development. When I went to put it into production I re-read the documentation and saw that it should ...

First update have side effets updates

I have a rails model named User, which have several attributes. In particular, User have an admin (boolean) attribute and an encrypted_password attribute (which is managed thanks to a virtual attribute named password with it password_confirmation). When I first create a user it works fine. My issue come when I update the admin ...

undefined method `encrypt_pasword'

I am trying to create a login/password web app. Getting the following error while running the app. undefined method encrypt_pasword' app/models/user.rb:32:inpassword=' app/controllers/users_controller.rb:43:in new' app/controllers/users_controller.rb:43:increate' Here is the code from control file. require 'digest/sha2' class User < ActiveRecord::Base include ActiveModel::MassAssignmentSecurity attr_accessible :name, :password, :password_confirmation, :hashed_password, :salt attr_accessor :name attr_accessor :salt validates :name, ...

Hiredis - is it possible to connect with one client to multiple channels?

I use a hiredis gem: https://github.com/mloughran/em-hiredis/blob/master/lib/em-hiredis/client.rb In gem-source is: def subscribe(channel) @subs << channel method_missing(:subscribe, channel) end Redis can connect with one client to multiple channels simultaneously: http://redis.io/commands/subscribe Redis> subscribe channel1, channel2, channel3 ......... How can i get this effect using hiredis? Below code doesn't work properly, i get multiple connections instead ...

Does Geocoder gem work with google API key?

I am using ruby geocoder gem for my project and as the project is growing I am starting to look into connecting to the Google API key. After adding this to the project: Geocoder.configure do |config| # geocoding service (see below for supported options): config.lookup = :google # to use an API key: config.api_key = ...

Like Facebook Fan Page through OpenGraph

Is it possible to like a facebook fan page using only the fanpage's URL with theopengraph api, and koala with rails. Koala provides the following but I have no idea what the number is in the function: @graph.put_like("7204941866_117111188317384") ...

How do i validate fields in the other rails table?

Ok so i have a Contact model class Contact < ActiveRecord::Base has_one :profile validates_presence_of :first_name validates_presence_of :last_name validates_presence_of :email class Profile < ActiveRecord::Base belongs_to :contact And on my form i have fields from that profile and the contact and the validations for the contacts show up ...

Law of Demeter with one-to-many associations

I'm confused about how to avoid Law of Demeter violations with one-to-many associations. Let's say I have a model like this: class Organization < ActiveRecord::Base has_one :address has_many :employees end I believe that it would be a Law of Demeter violation to do this: organization.address.street_name This could be avoided by having a *address_street_name* ...

Way over the limit of shared database on Heroku

I noticed today that my database is way over the 5MB limit on the shared database I'm using for a RoR app. Addons: New Relic Standard, PG Backups Basic, Shared Database 5MB Database Size: 135M Have they turned off the limits now when they release the ...

Create Array and Search Through in Ruby

Using devise, rails 3.2. I'm trying to figure out how to create an array of ids and then check if the current_user's id is included in this array. My users have many locations through location_users. (Locations have many users through the same relationship.) I can get a list of user_ids associated with ...

rspec failing validations

i have a meeting.rb and user.rb model meeting.rb class Meeting < ActiveRecord::Base attr_accessible :intro, :proposed_date, :proposed_location validates :requestor_id, presence: true validates :requestee_id, presence: true belongs_to :requestor, class_name: "User" belongs_to :requestee, class_name: "User" end user.rb class User < ActiveRecord::Base attr_accessible :name, :email, :password, :password_confirmation has_secure_password ...

Does this client-server design make sense? Is it practical?

The basic idea of the application I've been working on is to allow groups of users to collaborate on "Stacks" of flash cards. Eventually, the app will function as a client-server system (with an iOS app as the client, and a Rails app as the server) The requirements of this design, ...

« Previous12345678910 ... 41574158Next »Show All