Search Results

Search found 9437 results on 378 pages for 'rails newbie'.

Page 49/378 | < Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >

  • avoiding code duplication in Rails 3 models

    - by Dustin Frazier
    I'm working on a Rails 3.1 application where there are a number of different enum-like models that are stored in the database. There is a lot of identical code in these models, as well as in the associated controllers and views. I've solved the code duplication for the controllers and views via a shared parent controller class and the new view/layout inheritance that's part of Rails 3. Now I'm trying to solve the code duplication in the models, and I'm stuck. An example of one of my enum models is as follows: class Format < ActiveRecord::Base has_and_belongs_to_many :videos attr_accessible :name validates :name, presence: true, length: { maximum: 20 } before_destroy :verify_no_linked_videos def verify_no_linked_videos unless self.videos.empty? self.errors[:base] << "Couldn't delete format with associated videos." raise ActiveRecord::RecordInvalid.new self end end end I have four or five other classes with nearly identical code (the association declaration being the only difference). I've tried creating a module with the shared code that they all include (which seems like the Ruby Way), but much of the duplicate code relies on ActiveRecord, so the methods I'm trying to use in the module (validate, attr_accessible, etc.) aren't available. I know about ActiveModel, but that doesn't get me all the way there. I've also tried creating a common, non-persistent parent class that subclasses ActiveRecord::Base, but all of the code I've seen to accomplish this assumes that you won't have subclasses of your non-persistent class that do persist. Any suggestions for how best to avoid duplicating these identical lines of code across many different enum models?

    Read the article

  • rails 3 actionmailer cannot send email

    - by lkahtz
    I am following Ryan Bates's tutorial on Rails 3 ActionMailer. I generate the mailer in terminal and then establish a setup_mail.rb under config/initializers. I keyed in the following code: ActionMailer::Base.smtp_settings={ :address => "smtp.gmail.com", :port => 587, :domail => "gmail.com", :user_name => "my_account_at_gmail", :password => "my_password", :authentication => "plain" , :enable_starttls_auto => true } My user_mailer.rb file goes like: class UserMailer < ActionMailer::Base default :from => "[email protected]" def registration_confirmation(user) mail(:to => user.email,:subject => "registered") end end I tested in rails console: u=User.first UserMailer.registration_confirmation(u).deliver it displays: #<Mail::Message:2194479560, Multipart: false, Headers: <Date: Sat, 26 Feb 2011 14:42:06 +0800>, <From: [email protected]>, <To: [email protected]>, <Message-ID: <[email protected]>>, <Subject: registered>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: 7bit>> BUT I never received the email here... Why? How can I solve this? I guess it is some problem on send_mail.rb file..

    Read the article

  • Can't store UTF-8 in RDS despite setting up new Parameter Group using Rails on Heroku

    - by Lail
    I'm setting up a new instance of a Rails(2.3.5) app on Heroku using Amazon RDS as the database. I'd like to use UTF-8 for everything. Since RDS isn't UTF-8 by default, I set up a new Parameter Group and switched the database to use that one, basically per this. Seems to have worked: SHOW VARIABLES LIKE '%character%'; character_set_client utf8 character_set_connection utf8 character_set_database utf8 character_set_filesystem binary character_set_results utf8 character_set_server utf8 character_set_system utf8 character_sets_dir /rdsdbbin/mysql-5.1.50.R3/share/mysql/charsets/ Furthermore, I've successfully setup Heroku to use the RDS database. After rake db:migrate, everything looks good: CREATE TABLE `comments` ( `id` int(11) NOT NULL AUTO_INCREMENT, `commentable_id` int(11) DEFAULT NULL, `parent_id` int(11) DEFAULT NULL, `content` text COLLATE utf8_unicode_ci, `child_count` int(11) DEFAULT '0', `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `commentable_id` (`commentable_id`), KEY `index_comments_on_community_id` (`community_id`), KEY `parent_id` (`parent_id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; In the markup, I've included: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> Also, I've set: production: encoding: utf8 collation: utf8_general_ci ...in the database.yml, though I'm not very confident that anything is being done to honor any of those settings in this case, as Heroku seems to be doing its own config when connecting to RDS. Now, I enter a comment through the form in the app: "Úbe® ƒåiL", but in the database I've got "Úbe® Æ’Ã¥iL" It looks fine when Rails loads it back out of the database and it is rendered to the page, so whatever it is doing one way, it's undoing the other way. If I look at the RDS database in Sequel Pro, it looks fine if I set the encoding to "UTF-8 Unicode via Latin 1". So it seems Latin-1 is sneaking in there somewhere. Somebody must have done this before, right? What am I missing?

    Read the article

  • Rails RESTful routs without #new, rspec trouble

    - by pdkl95
    I'm currently writing a Rails app, and hit a somewhat strange quirk. I have a controller PermissionsController, which is mainly for display purposes at the moment. So my routing is locked down: map.resources :permissions, :only => [:index, :show] Unfortunately, when writing the tests, one of the routing tests fails: it "does not recognize #new" do { :get => "/permissions/new" }.should_not be_routable end with the error: Expected 'GET /permissions/new' to fail, but it routed to {"action"=>"show", "id"=>"new", "controller"=>"permissions"} instead Obviously, the #show action's route is matching with /permissions/:id, which also gives the expected error Couldn't find Permission with ID=new if you actually browse to that URL. This is not a serious error, as it is correctly raising an exception with the bad :id parameter, but it's kind of ugly. Is there any way to actually make Rails reject that route? Some trick in the routing options that I'm missing? I suppose I should just leave that test out and ignore it, or maybe remove the whole RESTful idea altogether and go back to a simpler map.connect 'permissions/:id' style. I strongly suspect I'll be expanding this in the future, though, and kind of wanted to keep my controllers consistent with each other. Just having to add occasional :only or :except rules made routes.rb nice and clean...

    Read the article

  • Ruby on Rails or PHP... Somehow uncertain

    - by Clamm
    Hi everybody... I've been thinking about this a long time now but i wanna hear your opinion because i always received the ebst answers here. So in advance... thank you guys. Right now i have to make this decision: Shift a prototype webservice to production quality. Choose either Ruby or PHP... (Background: A friend of mine is joining the project and prefers rails) I've already played around a bit with RoR (only basic stuff) but i am really disappointed about the documentation of Rails and Ruby. In relation to PHP i find only fragments or hard to use references. At the end i am a bit scared. I dont wanna waste my time realizing that i am not capable of doing s.th in Ruby what i could with PHP. Maybe only because i am too stupid and don't find a proper explanation ;-) Did anyone experience this shift and can tell me how easy/hard it was to switch from PHP to Ruby? E.G. would you recommend programming it in PHP and using MVC as a base pattern? Thanks for your opinion!!!

    Read the article

  • Weird Rails database errors

    - by Jason Swett
    I've had some trouble getting my Rails app to connect to PostgreSQL so I decided to just say screw it and use SQLite for now. (I'm using the tutorial here: http://guides.rubyonrails.org/getting_started.html) I started a BRAND NEW, fresh Rails app from this tutorial. When I visit my app in the browser after deleting public/index.html, I get this the first time: Please install the pg adapter: `gem install activerecord-pg-adapter` (no such file to load -- active_record/connection_adapters/pg_adapter) That's odd to me because I'm not mentioning PostgreSQL anywhere. Here's my databases.yml: # SQLite version 3.x # gem install sqlite3-ruby (not necessary on OS X Leopard) development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: sqlite3 database: db/test.sqlite3 pool: 5 timeout: 5000 production: adapter: sqlite3 database: db/production.sqlite3 pool: 5 timeout: 5000 To make things more confusing, I only get that "pg adapter" error on the first load. For every subsequent page request, I get this error: ActiveRecord::ConnectionNotEstablished So even though I removed all mention of PostgreSQL, I'm still getting errors. What could be going on?

    Read the article

  • Apache's AuthDigestDomain and Rails Distributed Asset Hosts

    - by Jared
    I've got a server I'm in the process of setting up and I'm running into an Apache configuration problem that I can not get around. I've got Apache 2.2 and Passenger serving a Rails app with distributed asset hosting. This is the feature of Rails that lets you serve your static assets from assets0.example.com, assets1, assets2, and so on. The site needs to be passworded until launch. I've set up HTTP authentication on the site using Apache's mod_auth_digest. In my configuration I'm attempting to use the AuthDigestDomain directive to allow access to each of the asset URLs. The problem is, it doesn't seem to be working. I get the initial prompt for the password when I load the page, but then the first time it loads an asset from one of the asset URLs, I get prompted a 2nd, 3rd, or 4th time. In some browsers, I get prompted for every single resource on the page. I'm hoping that this is only a problem of how I'm specifying my directives and not a limitation of authorization in Apache itself. See the edited auth section below: <Location /> AuthType Digest AuthName "Restricted Site" AuthUserFile /etc/httpd/passwd/passwords AuthGroupFile /dev/null AuthDigestDomain / http://assets0.example.com/ http://assets1.example.com/ http://assets2.example.com/ http://assets3.example.com/ require valid-user order deny,allow allow from all </Location>

    Read the article

  • Rails dealing with blank params at controller level

    - by stephenmurdoch
    I have a User model: class User < ActiveRecord::Base has_secure_password # validation lets users update accounts without entering password validates :password, presence: { on: :create }, allow_blank: { on: :update } validates :password_confirmation, presence: { if: :password_digest_changed? } end I also have a password_reset_controller: def update # this is emailed to the user by the create action - not shown @user=User.find_by_password_reset_token!(params[:id]) if @user.update_attributes(params[:user]) # user is signed in if password and confirmation pass validations sign_in @user redirect_to root_url, :notice => "Password has been reset." else flash.now[:error] = "Something went wrong, please try again." render :edit end end Can you see the problem here? A user can submit a blank a password/confirmation and rails will sign them in, because the User model allows blank on update. It's not a security concern, since an attacker would still need access to a user's email account before they could get anywhere near this action, but my problem is that a user submitting 6 blank chars would be signed in, and their password would not be changed for them, which could lead to confusion later on. So, I've come up with the following solution, and I'd like to check if there's a better way of doing it, before I push to production: def update @user=User.find_by_password_reset_token!(params[:id]) # if user submits blank password, add an error, and render edit action if params[:user][:password].blank? @user.errors.add(:password_digest, "can't be blank.") render :edit elsif @user.update_attributes(params[:user]) sign_in @user redirect_to root_url, :notice => "Password has been reset." else flash.now[:error] = "Something went wrong, please try again." render :edit end end Should I be checking for nil as well as blank? Are there any rails patterns or idiomatic ruby techniques for solving this? [Fwiw, I've got required: true on the html inputs, but want this handled server side too.]

    Read the article

  • Handling Email Bouncebacks in Rails

    - by aressidi
    Hi there, I've built a very basic CRM system for my rails app that allows me to send weekly user activity digests with custom text and create multi-part marketing messages which I can configure and send through a basic admin interface. I'm happy with what I've put together on the send-side of things (minus the fact that I haven't tried to volume test its capabilities), but I'm concerned about how to handle bounce-backs. I came across this plugin with associated scripts: http://github.com/kovyrin/bounces-handler I'm using Google Apps to handle my mail and really don't know enough about Perl to want to mess with the above plugin - I have enough headaches. I'm looking for a simple solution for processing bounce-backs in Rails. All my email will go out from an address like this which will be managed in Google Apps: "[email protected]." What's the best workflow for this? Can anyone post an example solution they're using keeping in mind the fact that I'm using Google Apps for the mail? Any guidance, links, or basic workflow best-practices to handle this would be greatly appreciated. Thanks! -A

    Read the article

  • Rails exit controller after rendering

    - by codysehl
    I have an action in my controller that I am having trouble with. This is my first rails app, so I'm not sure of the best practices surrounding rails. I have a model called Group and a few actions that go in it's controller. I have written a test that should cause the controller to render an error in JSON because of an invalid Group ID. Instead of rendering and exiting, it looks like the controller is rendering and continuing to execute. Test test 'should not remove group because of invalid group id' do post(:remove, {'group_id' => '3333'}) response = JSON.parse(@response.body) assert_response :success assert_equal 'Success', response['message'] end Controller action # Post remove # group_id def remove if((@group = Group.find_by_id(params[:group_id])) == nil) render :json => { :message => "group_id not found" } end @group.destroy if(!Group.exists?(@group)) render :json => { :message => "Success" } else render :json => { :errors => @group.errors.full_messages } end end In the controller, the first if statement executes: render :json => { :message => "group_id not found" } but @group.destroy is still being executed. This seems counter-intuitive to me, I would think that the render method should exit the controller. Why is the controller not exiting after render is called? The purpose of this block of code is to recover gracefully when no record can be found with the passed in ID. Is this the correct way of doing something like this?

    Read the article

  • Rails active record association problem

    - by Harm de Wit
    Hello, I'm new at active record association in rails so i don't know how to solve the following problem: I have a tables called 'meetings' and 'users'. I have correctly associated these two together by making a table 'participants' and set the following association statements: class Meeting < ActiveRecord::Base has_many :participants, :dependent => :destroy has_many :users, :through => :participants and class Participant < ActiveRecord::Base belongs_to :meeting belongs_to :user and the last model class User < ActiveRecord::Base has_many :participants, :dependent => :destroy At this point all is going well and i can access the user values of attending participants of a specific meeting by calling @meeting.users in the normal meetingshow.html.erb view. Now i want to make connections between these participants. Therefore i made a model called 'connections' and created the columns of 'meeting_id', 'user_id' and 'connected_user_id'. So these connections are kinda like friendships within a certain meeting. My question is: How can i set the model associations so i can easily control these connections? I would like to see a solution where i could use @meeting.users.each do |user| user.connections.each do |c| <do something> end end I tried this by changing the model of meetings to this: class Meeting < ActiveRecord::Base has_many :participants, :dependent => :destroy has_many :users, :through => :participants has_many :connections, :dependent => :destroy has_many :participating_user_connections, :through => :connections, :source => :user Please, does anyone have a solution/tip how to solve this the rails way?

    Read the article

  • Using Wicked with Devise for a sign up wizard

    - by demondeac11
    I am using devise with wicked to create a sign up wizard, but I am unsure about a problem I am having creating profiles. After a user provides their email & password they are forwarded to a step to create a profile based on whether they have specified they are a shipper or carrier. However I am unsure what the code should be in the controller and the forms to generically create a profile. Here is the code I have for the application: The steps controller: class UserStepsController < ApplicationController include Wicked::Wizard steps :carrier_profile, :shipper_profile def create @user = User.last case step when :carrier_profile @profile = CarrierProfile.create!(:dot => params[:dot]) if @profile.save render_wizard @user else flash[:alert] = "Record not saved" end when :shipper_profile @profile = ShipperProfile.create!(params[:shipper_profile) if @profile.save render_wizard @user else flash[:alert] = "Record not saved" end end end end end def show @user = User.last @carrier_profile = CarrierProfile.new @shipper_profile = ShipperProfile.new case step when :carrier_profile skip_step if @user.shipper? when :shipper_profile skip_step if @user.carrier? end render_wizard end end The form for a carrier profile: <% form_for @carrier_profile , url: wizard_path, method: :post do |f| %> <div> <%= f.label :dot, "Please enter your DOT Number:" %> <%= f.text_field :dot %> </div> <%= f.submit "Next Step", class: "btn btn-primary" %> <% end %> The form for a shipper profile: <% form_for @shipper_profile , url: wizard_path, method: :post do |f| %> <div> <%= f.label :company_name, "What is your company name?" %> <%= f.text_field :company_name %> </div> <%= f.submit "Next Step", class: "btn btn-primary" %> <% end %> The user model: class User < ActiveRecord::Base has_one :carrier_profile has_one :shipper_profile end How would I be able to write a generic new and create method to handle creating both profiles? With the current code it is stating that the user_steps controller has no POST method, although if I run rake routes I find that this is untrue.

    Read the article

  • devise roles: different roles, in some cases same rights

    - by mattherick
    I have two roles in devise. The first is the admin and the second the normal user-role. Now I´d like to give these two groups in some cases same rights with before filters. How does this work? I have: before_filter :authenticate_user!, :only = [:new, :create] before_filter :authenticate_admin!, :only = [:new, :create, :edit, :update, :destroy] But now only a user can :new and :create...the admin not.. What I have to do here? Thanks, Mattherick

    Read the article

  • Where are the factory_girl records?

    - by gmile
    I'm trying to perform an integration test via Watir and RSpec. So, I created a test file within /integration and wrote a test, which adds a test user into a base via factory_girl. The problem is — I can't actually perform a login with my test user. The test I wrote looks as following: ... before(:each) @user = Factory(:user) @browser = FireWatir::Firefox.new end it "should login" @browser.text_field(:id, "username").set(@user.username) @browser.text_field(:id, "password").set(@user.password) @browser.button(:id, "get_in").click end ... As I'm starting the test and see a "performance" in browser, it always fires up a Username is not valid error. I've started an investigation, and did a small trick. First of all I've started to have doubts if the factory actually creates the user in DB. So after the immediate call to factory I've put some puts User.find stuff only to discover that the user is actually in DB. Ok, but as user still couldn't have logged in I've decided to see if he's present in DB with my own eyes. I've added a sleep right after a factory call, and went to see what's in the DB at the moment. I was crushed to see that the user is actually missing there! How come? Still, when I'm trying to output a user within the code, he is actually being fetched from somewhere. So where does the records, made by factory_girl within a runtime lie? Is it test or dev DB? I don't get it. I've 10 times checked if I'm running my Mongrel in test mode (does it matter? I think it does, as I'm trying to tun an integration test) and if my database.yml holds the correct connection specific data. I'm using an authlogic, if that can give any clue (no, putting activate_authlogic doesn't work here).

    Read the article

  • Add a :filter param to the end of a url

    - by bob
    Hello, I am building an application that requires a search to go deeper than the initial level. I am using nested scopes to accomplish this and params in the URL For example, when a user searches for "handbag" it creates a query like the following. http://localhost:3000/junks?search=handbag&condition=&category=&main_submit=Go! I want to add a :filter param to the end of this url and reload the page with the new url. http://localhost:3000/junks?search=handbag&condition=&category=&main_submit=Go!&filter=lowest_price As shown above the &filter=lowest_price is added to the query. I have already written controller code to handle this and I know it works as long as the query is like the 2nd link above. my views code <div class = "filter_options"> <p> <strong>Filter by:</strong> <%= link_to_unless_current "Recent", :filter => 'recent' %> | <%= link_to_unless_current "Lowest Price", :filter => 'lowest_price' %> | <%= link_to_unless_current "Highest Price", :filter => 'highest_price' %> </p> </div> This is how I have it currently, which works if my URL does not have a search string attached to it. Unfortunately, this will go to a http://localhost:3000/junks?filter=lowest_price even if there is a search string. I would like to know how to create my links so that they add onto the search string shown in the 2nd code example. Additionally, if a search string with a filter is already present, it would only change that filter and resubmit the search string with the new filter. I hope I am being clear.

    Read the article

  • Facebooker extended permissions??

    - by Ivan
    Facebook gives access to users' emails via the extended permission. There's also a way in JS and PHP to force users to grant the permission when they accept the app's TOS - http://wiki.developers.facebook.com/index.php/Extended_permissions Is there a way that I can do this with Facebooker? Regards..

    Read the article

  • Testing Paypal error messages using ActiveMerchant

    - by vrish88
    Hello, Is there a way to test your application's processing and handling of Paypal generated credit card errors? I'd like to verify that my application can handle a declined credit card or something like that. So is there a way to have Paypal send an error message? Or would it be better to generate a stub and use it in the testing environment? If this is the better way, how would one generate a stub? Thanks!

    Read the article

  • ~/.irbrc not executed when starting irb or script/console

    - by Patrick Klingemann
    Here's what I've tried: 1. gem install awesome_print 2. echo "require 'ap'" >> ~/.irbrc 3. chmod u+x ~/.irbrc 4. script/console 5. ap { :test => 'value' } Result: NameError: undefined local variable or method `ap' for # Some additional info: Fedora 13 (observed this issues in prior versions of Fedora also) bash --version Produces: GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

    Read the article

  • FasterCSV Parsing issue?

    - by Schroedinger
    G'day guys, I'm currently using fastercsv to construct ActiveRecord elements and I can't for the life of me see this bug (tired), but for some reason when it creates, if in the rake file i output the column I want to save as the element value, it puts out correctly, as either a Trade or a Quote but when I try to save it into the activerecord, it won't work. FasterCSV.foreach("input.csv", :headers => true) do |row| d = DateTime.parse(row[1]+" "+row[2]) offset = Rational(row[3].to_i,24) o = d.new_offset(offset) t = Trade.create( :name => row[0], :type => row[4], :time => o, :price => row[6].to_f, :volume => row[7].to_i, :bidprice => row[10].to_f, :bidsize => row[11].to_i, :askprice => row[14].to_f, :asksize => row[15].to_i ) end Ideas? Name and Type are both strings, every other value works except for type. Have I missed something really simple?

    Read the article

  • Adding lengths of strings together in Ruby

    - by ppreyer
    I'm trying to write a program that takes the length of my first, middle, and last names individually and then adds the total amount of letters up in the end. My answer keeps on being 666 instead of 18. Here is the code I have written: puts 'What is your first name?' firstName = gets.chomp realFirstName = firstName.length.to_i puts 'What is your middle name?' middleName = gets.chomp realMiddleName = middleName.length.to_i puts 'What is your last name?' lastName = gets.chomp realLastName = lastName.length.to_i puts 'Did you know there are ' + realFirstName.to_s + realMiddleName.to_s + realLastName.to_s + ' letters in your name?' Just wondering where I went wrong.

    Read the article

  • Ruby 'if' condition in rjs

    - by ash34
    Hi, I want to insert a user in the userlist only if the user object (@row) is not nil. How do I do the insert conditionally in an rjs template? page.insert_html :bottom, :userlist, render(:partial = "user", :locals = { :user = @row, :myid = @row.id }) thanks much.

    Read the article

  • rails3 link_to :with attribute?

    - by z3cko
    i am wondering if the :with attribute is removed from rails3 since i cannot find anything in the rails3 api - http://rails3api.s3.amazonaws.com anyone has a clue or give a hint on how to use the :with parameter to send data with a link_to non-working example: = link_to "Foo", {:action => "filter", :filter => "filter1",:with => "'test='+$('search').value"}, :remote => true, :class => "trash unselected", :id => "boo" thanks!

    Read the article

  • How to setup default attributes in a ruby model

    - by webdestroya
    I have a model User and when I create one, I want to pragmatically setup some API keys and what not, specifically: @user.apikey = Digest::MD5.hexdigest(BCrypt::Password.create("jibberish").to_s) I want to be able to run User.create!(:email=>"[email protected]") and have it create a user with a randomly generated API key, and secret. I currently am doing this in the controller, but when I tried to add a default user to the seeds.rb file, I am getting an SQL error (saying my apikey is null). I tried overriding the save definition, but that seemed to cause problems when I updated the model, because it would override the values. I tried overriding the initialize definition, but that is returning a nil:NilClass and breaking things. Is there a better way to do this?

    Read the article

  • Mysql::Error: Duplicate entry

    - by Shaliko
    Hi I have a model class Gift < ActiveRecord::Base validates_uniqueness_of :giver_id, :scope => :account_id end add_index(:gifts, [:account_id, :giver_id], :uniq => true) Action def create @gift= Gift.new(params[:gift]) if @gift.save ... else ... end end In the "production" mode, I sometimes get an error ActiveRecord::StatementInvalid: Mysql::Error: Duplicate entry '122394471958-50301499' for key 'index_gifts_on_account_id_and_user_id' What the problem?

    Read the article

  • Mysql::Error: Duplicate entry

    - by Shaliko
    Hi I have a model class Gift < ActiveRecord::Base validates_uniqueness_of :giver_id, :scope => :account_id end add_index(:gifts, [:account_id, :giver_id], :uniq => true) Action def create @gift= Gift.new(params[:gift]) if @gift.save ... else ... end end In the "production" mode, I sometimes get an error ActiveRecord::StatementInvalid: Mysql::Error: Duplicate entry '122394471958-50301499' for key 'index_gifts_on_account_id_and_giver_id' What the problem?

    Read the article

< Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >