Displaying 20 results from an estimated 11000 matches similar to: "sessions (newbie problem)"
2006 Jul 26
2
sessions
hi!
im implementing a login system for a messageboard. tooked from a book.
pretty simple. everythings works great, but in the example the idea is,
when i want to create a new message, the author name shall be tooked
from the session[:user]
def create
params[:message][:date] = Time.now
params[:message][:author_id] = @session[:user].id #here!!
@message =
2005 May 24
3
textilize/markdown/sanitize for messageboards, oh my!
Hullo, fellow Railsers!
(warning: this isn''t a 100% Rails specific question, but I guess it
very much applies to what a lot of us are currently doing.)
For a project that involves messageboard functionality I''m looking for
a good way of sanitizing user input, so the silly fools, err, my
wonderful users don''t mess things up too much. I''ve played around with
2006 Apr 24
0
Called id for nil, which would mistakenly be 4 -- if you really wanted the idof nil, use object_id - solved
Hi Bill,
No I am not using Instant Rails.
>There are lots of variations possible. Typos and capitalisation
represent the largest proportion of errors I personally have made.
Thanks a lot....solved the problem. Changed recipes (plural) in
controller file to recipe (singular). That teaches me to pay *real*
attention to casing. (forgive me, I am from the VS and VB world :-)
>Actually,
2006 Apr 21
3
Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
Hi
I am a newbie to Ruby on Rails, but experienced in programming.
I am trying out Rolling with Ruby on Rails article by Curt Hibbs on
onlamp.com. I have encountered following error:
Called id for nil, which would mistakenly be 4 -- if you really wanted
the id of nil, use object_id
I searched the archives of the list and found that similar
question was left unanswered. I do understand from
2006 Apr 04
3
How to use in_place_editor_field ?
Hello, I really don''t understand how to use in_place_editor_field
In my controller :
class Admin::CategoriesController < Admin::BaseController
in_place_edit_for :category, :title
def list
@categories = Category.find_all
end
end
In the view list.rhtml
<% @categories.each do |c| %>
<td><%= in_place_editor_field :c, c.title %></td>
# snip
<%
2006 Sep 21
0
post.author_id or post.author ? Rails bug?
Hi all!
I have just found something very strange.
Let''s imagine that I have posts that belong to an author.
If I do the following (the order doesn''t matter):
apost.author = Author.find(3)
apost.author_id = 2
I get a post that has both an :author_id => 2 attribute, and an
associated Author with id 3.
Then, post.save, and the author_id in the DB is 3.
I think that this
2009 May 24
6
belongs_to not saving foreign key
Under Rails 2.3.2 using a completely brand new project, I have 2
models:
class Author < ActiveRecord::Base
# name:string
end
class Book < ActiveRecord::Base
# title:string
belongs_to :author # author_id
end
And a simple test where i create a Book with an Author using the
belongs_to and then update the foreign key directly:
require ''test_helper''
class BookTest
2009 Nov 18
4
rails newbie : routing error
After much ado about the naming of model adn controllers...
model : Expense
controller : Expenses
route : map.resources :expenses
Here I am using mysql database and created a unique index, since
db:migrated created an id object and made it as primary key. Now in
the
def create
@expense = Expense.new(params[:expense])
if @expense.save
flash[:viola] = ''New expense saved.. be
2006 Mar 28
2
In_place_editor_field throws error ...
I receive the following error:
Called id for nil, which would mistakenly be 4 -- if you really wanted
the id of nil, use object_id
when trying to use the in_place_editor_field tag:
<% for employee in @employees %>
<%= in_place_editor_field :employee, employee.fname %>
<% end %>
My model is called Employee and is being populated from a controller
method employees_list:
2006 Jun 13
6
Dead horse: validates_associated
Regarding validates_associated...
Let''s say I have:
article belongs_to author
But for whatever reason, I want an article to also be written
anonymously and therefore not require an author. Then I have:
Article:
belongs_to :author
validates_associated :author
But I DON''T have validates_presence_of. What I want to do is validate
that an author is valid --if it is
2009 Aug 17
1
Problem with setter override on ActiveRecord
(This message was originally written on StackOverflow -- the
formatting is much prettier there --
http://stackoverflow.com/questions/1283046/problem-with-setter-override-on-activerecord)
This is not exactly a question, it''s rather a report on how I solved
an issue with write_attribute when the attribute is an object, on
Rails'' Active Record. I hope this can be useful to others
2006 Jul 24
7
[PATCH] Support for DB Clusters/Replication in ActiveRecord (RFC)
Skipped content of type multipart/alternative-------------- next part --------------
Index: connection_adapters/abstract/connection_specification.rb
===================================================================
--- connection_adapters/abstract/connection_specification.rb (revision 4617)
+++ connection_adapters/abstract/connection_specification.rb (working copy)
@@ -1,10 +1,21 @@
require
2009 Nov 04
4
[PATCH server] Update daemons to use new QMF.
This patch updates dbomatic, taskomatic and host-register to use the
new C++ wrapped ruby QMF bindings. It also fixes a couple of bugs
along the way including the 0 cpu bug for host-register. This is a
compilation of work done by myself and Arjun Roy.
Signed-off-by: Ian Main <imain at redhat.com>
---
src/db-omatic/db_omatic.rb | 111 ++++++-------
2005 Dec 29
3
Verification problems
Hello,
Hope this isn''t a newbie question - but I don''t seem to be able to find
relevent information elsewhere.
I am having trouble getting the following to work:
Schema
======
ActiveRecord::Schema.define(:version => 1) do
create_table "authors", :force => true do |t|
t.column "name", :string
end
create_table "books", :force =>
2006 May 22
1
Agile Web Dev unit test fails with fixture instance variable
I''m following Agile Edition 1. On page 148 it suggests using instance
variables named after the fixture, for example:
assert_equal @version_control_book.id, @product.id
When I introduce this type of instance variable into my test, I get the
following error:
1) Error:
test_not_owner(GroupTest):
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you
really wanted the
2011 Sep 21
0
hooking into `to_prepare` in a Railtie *after* the files have been reloaded (in dev)
I''m working on a gem <https://github.com/bradrobertson/apartment> that sets
properties on ActiveRecord models (such as table_name) dynamically based on
a user config option.
I have an initializer that achieves this. My problem however is that in dev
mode, these classes are reloaded, so they don''t maintain these values set.
So I thought I''d use a railtie to
2009 Nov 13
1
[PATCH server] Replace the occurence of the type @qmfc.object(Qmf::Query.new(:class => "xxx", 'key' => search_key)) for @qmfc.object(Qmf::Query.new(:class => "xxx"), 'key' => search_key) else the search on the key is not functionnal.
This fix db-omatic that cannot recover the node on wich the vm run for example.
We have not investigate far away but that can be due to a change on the ruby-qmf API.
Signed-off-by: Michel Loiseleur <mloiseleur at linagora.com>
---
src/db-omatic/db_omatic.rb | 10 ++++++----
src/libvirt-list.rb | 6 +++---
src/matahari-list.rb | 4 ++--
3 files changed, 11
2009 Jul 21
1
[PATCH server] Fixed db-omatic so it doesn't segfault because of newer qmf api.
---
src/db-omatic/db_omatic.rb | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/db-omatic/db_omatic.rb b/src/db-omatic/db_omatic.rb
index 155ff5e..b5b7b81 100755
--- a/src/db-omatic/db_omatic.rb
+++ b/src/db-omatic/db_omatic.rb
@@ -270,10 +270,10 @@ class DbOmatic < Qpid::Qmf::Console
end
def object_props(broker, obj)
- target =
2010 Jun 29
3
belongs_to. Association methods don't pass data to DB
Hi.
I have a problem with the association methods which passed to a model
through a belongs_to declaration. Here''s an illustration of the issue:
GIVEN:
# migration
class CreateArticlesAndAuthorsTables < ActiveRecord::Migration
def self.up
create_table :articles do |t|
t.text :title
t.integer :author_id
end
create_table :authors do |t|
t.text
2009 Aug 12
5
Challenge for object_id, Garbage Value
I am facing strange problem.
I have an object @part=MainPart.find(:all)
1. @part.each_with_index do |mainpart,index|
2. <p><%= mainpart.object_id%></p>
3. end
Here problem is that object_id is reserved for rails. Here
object_id field in my table . Now i want to get value <%=
mainpart.object_id%> is giving GARBAGE VALUE. Is there any solution
apart from