similar to: displaying database errors

Displaying 20 results from an estimated 60000 matches similar to: "displaying database errors"

2006 Mar 08
5
object.save is not creating an insert statement
I have a model for a task class. When I try to save a task, for some reason no INSERT statement is being generated. Here''s the pertinent part of the development.log: ------------------------------------ Processing TasksController#create_fromProject (for 70.247.24.238 at 2006-03-08 14:20:30) [POST] Parameters: {"commit"=>"Create",
2005 Dec 31
2
Validation errors not displaying and will not save
Hello all, I''m fairly new to rails so I''m probably doing something really stupid here.... I have been banging my head at this for hrs now... I''ve tried so many different things and nothing seems to get me any further... I am trying to create an image uploading page that will simultaneously create thumbnails to separate file directories and update the database via
2007 Jul 12
3
Agh, this is annoying. Why is this happening?
My problem: Mock ''Task_1005'' received unexpected message :user_id= with (1) No matter what I do to try to stub that out it will still fail out and give me that message. Here is my spec describe TasksController, "handling POST /tasks" do before(:each) do @task = mock_model(Task, :to_param => "1", :save => true)
2006 Aug 16
3
Validate your forms with a table-less model
Ive followed this example of how to validate a form with a tableless model: http://rails.techno-weenie.net/tip/2005/11/19/validate_your_forms_with_a_table_less_model Ive got this example working but when validation fails the failed boxes are not highlighted in red. At the moment i have a contact details form and want to validate the information entered by the user but this will just result
2006 Jun 13
4
When saving parent fails, children will still be updated
Hi all, When submitting a master/detail form I first want to handle the children before saving the parent. There are has_many and belongs_to relations between the parent and the children, so I can edit the children using (psuedo-)code like: child.destroy for deleting, child.update_attributes for updating and @parent.children.push(child) for adding child-records. I update the parent by using:
2010 Dec 17
1
flash[;notice] not display after redirection
I read all previous posts about the same subject in Devise group but couldn''t find any answer, so iy may not be related to Devise , so I debugged it .. . class Users::RegistrationsController < Devise::RegistrationsController .. # POST /resource/sign_up def create build_resource if resource.save if resource.active? set_flash_message :notice, :signed_up
2006 Mar 22
1
Generic ''save'' function for multiple objects?
I''ve been working with developing a few rails/mysql applications to replace some rather shoddy access databases that are currently in use here. It''s going well but I ran into one area that I''m curious if there is a way to improve. Basically the database has several instances of Many-to-Many relationships to handle different things. At present each of these has a
2006 Feb 08
1
Weird validation issue
Hi, I''m having a weird validation issue. Validation isn''t working for certain attributes and, for some reason, it''s also affecting things outside of validation. For campers on certain camp types, we require some information about their school. I tried to validate the information this way: validates_presence_of :school_type, :if => Proc.new { |c| !c.booking.nil?
2006 Apr 27
2
NoMethodError - why?
Getting this error when hitting update. NoMethodError in Article#update You have a nil object when you didn''t expect it! You might have expected an instance of ActiveRecord::Base. The error occured while evaluating nil.update_attributes Source code. def create @article = Article.new(params[:article]) @article.user = @session[''user''] if @article.save
2006 Jul 17
2
error_messages_for ?
Hi, I can''t list error_messages in my Form ??, and all the formfields are reset ...(I think my redirect :back clean everything, formfield and error_messages ...), only my flash[:notice] is ok.... I would like to use the "error_messages_for" tag to add a simple red * on my textfiled if a problem occurs ... thanks for help arnaud here are the basics steps to check that
2006 Feb 15
6
error_messages_for trouble
I am trying so learn how to do custom validations. The validation works as expected, but I can''t get "error_messages_for" to display. How is the name of the object supposed to be formated? Where is this object created, the model or controller? What am I doing wrong here? #### Model ######################## class MyFolder < ActiveRecord::Base def validate # validation
2006 Apr 02
5
Showing current user''s information and saving
Hi, I am logging users in and keeping them in session. The problem I am having is showing only a certain logged in user''s information. In the Adverts_Controler: def show @advert = Advert.find(params[:id]) end I am also having issues with saving an advert for an user: def create @advert = Advert.new(params[:advert]) if @advert.save flash[:notice] = ''Advert
2008 Sep 10
5
xmlhttprequest for updating
Hello, I am updating an object with an AJAX form: view: <% remote_form_for(@sample, :update => "content2") do %> <p> parameter: <br /> <%= select("sample","parameter",Parameter.find(:all).collect {|p| [p.description.gsub(''_'', '' ''),p.id]},{},{:size => 4, :multiple => true}) %>
2006 Jul 03
1
Model Relations, Creating, Errors and stuff
Hi, I''ve searched the Agile.. book and tried google etc. but my main problem is not being able to think of keywords. I''m trying to save something with user info, and then further info if they are staff in a one-to-one relationship. I can do this all fine and good. def create @user = User.new(params[:user]) @staff_member = StaffMember.new(params[:staff_member])
2007 Oct 01
3
stringify_keys!
I have seen this numerious times and still have no idea what it means: undefined method `stringify_keys!'' for "blah22":String I am tring to change a password. My code looks like: def change_password @user = User.find_by_emailaddr( params[:email] ) if @user.nil? # user profile not created flash[:notice] = "<b style = \"color:red\">No such
2006 Jul 19
5
Model Validation - with a twist
I''m stuck in a catch-22 type problem. I have an insert form for a table that uses the validation in the model. i.e. When you click submit on the form and haven''t filled in the required fields then you get the nice rails error messages saying "field can not be blank". This works fine until I introduce some more logic. What I''m trying to do is to validate
2006 Feb 27
3
form questions
I have a very simple form that looks allows an input for an error code and then give the show page from the scaffolding if the error code is in the database and a notification on the list page, again from the scaffolding if not. Here''s the form: find.rhtml <h1>Find error</h1> <%= start_form_tag :action => ''search''%> <p><label
2008 Jul 08
1
Problems with form_remote_tag
Hi, I am trying to use form_remote_tag to update a record and then update the section of the page where id=''opertion_panel''. There is a javascript validation that validates the input before the record is being updated. This validation works and the record was successfully updated. The problem is after the record is being updated, it didn''t update operation_panel.
2006 Jul 07
4
need help with some ugly code - is there a better way?
Hi, In my user_controller.rb, I have the following method, which is supposed to send the user to their profile, dependng on what "role" they are (the roles correspond to the other controllers: venue, band, fan): def login if request.post? if session[:user_id] = User.authenticate(params[:user][:login], params[:user][:password]) flash[:message] =
2006 Aug 07
3
simple if - then question
hi, could somebody tell me the difference between: if not params[:id] flash[:notice] = blabla'' redirect_to(:controller =>"calendar", :action => ''index'') end and: if params[:id] == nil flash[:notice] = blabla'' redirect_to(:controller =>"calendar", :action => ''index'') end the first one