Displaying 20 results from an estimated 400 matches similar to: "has_many and belongs_to relationship error"
2007 Nov 17
18
Syntax Problem
I admit I am stuck. I am converting a legacy php site to ROR. The old
site uses MD5, a security flaw waiting to happen. I upgraded to AAA
and am adding code in the session_controller.rb file to see if
crypted_password is blank. If it is, crypt and check the password
against the old md5 version and write it in the new crypted_password
field.
Here is my code add on before the logged_in?:
def
2008 Apr 15
4
ActiveRecord::StatementInvalid in BlogController#index
Hello. I''m trying to do the video tutorial "how to build a blog engine
in 15 minutes with ruby on rails" from the main rubyonrails website,
and I''m getting an error when I try to use scaffold :post after
editing my config file for the mysql database.
Here is the exact error I''m getting:
ActiveRecord::StatementInvalid in BlogController#index
2006 Jul 11
1
Problems using the authorization plugin from Bill Katz
Hello everyone,
I was trying to set up access control in a new application Im working on,
I''m trying to use the excellent authorization plugin from Bill Katz,
Its pretty straight forward to setup and should be to use.
But when i try to give the same permission on two differents users on
the same object i get an error.
(Well , Im kinda new to all this rails stuff)
r = Red.find(1)
u1 =
2008 Jan 30
1
undefined method `scaffold'
Hello,
I have been busy for a while and now I am back to messing with rails.
Last time I tried to use scaffold i worked now I am getting this error.
Not really sure since I am using version 1.2.5 still
NoMethodError in BlogController#index
undefined method `scaffold'' for #<BlogController:0x506eb7c>
Session dump
flash: !map:ActionController::Flash::FlashHash {}
Thanks for any
2010 Aug 18
6
Once I added this HABTM, one of my 'through' relationships, on a non-habtm model, seems to have broke?
I''m a rails newb and have been Googling about this, but I''m still stumped.
Not showing everything here, but basically it should be a pretty common
setup so I''m sure others know what I''m doing wrong.
- A meter can belong to many meter_groups
- A meter_group can have many meters.
- A user can ''subscribe'' to viewing a meter_group (Subscription)
2006 May 08
6
how to make field in model immutable after create
Hello everyone!
I want to have login field in User model which is set only once (on
create), and then it should fail validation if the value is changed.
How can I do this? I dig around for validation and tried
def after_validation_on_update
unless User.find_by_login(:login)
errors.add(:login, "is immutable. You can''t change it")
end
end
in model, but somewhat it
2007 Aug 27
2
Can FILTERS AND VERIFICATION functions take arguments?
Hi,
I have some problems in using filter. My filter functions need to have
arguments, but filter functions take only symbol that refer to
function name. Consider the following code:
class BlogController < ApplicationController
before_filter :authorize
For instance, authorize need arguments. So how can I pass arguments to
filter function?
Any helps always appreciate.
2006 Jan 29
2
GetText and rjs templates?
hi,
is it possible that gettext don''t work with rjs templates?
i''ve just tried this simple example
blog_controller.rb :
class BlogController < ApplicationController
def index
end
def dosomething
end
end
index.rhtml :
<html>
<head>
<%= javascript_include_tag :defaults %>
</head>
<body>
<div id="test">Some text to change
2006 Apr 24
7
Controller can''t find helper?????!!!!!????
I have a controller named xyzController under app/controllers
I have a helper class named xyzHelper under app/helpers.
Shouldn''t I be able to call methods from xyzHelper inside of
xyzController without any problems?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
2006 Apr 04
1
Calling a method in another controller
Hi,
I have three controllers. I have defined two controllers to goven the
site functions. However I want to have a homepage Controller. Part of
the controller will call methods from other controllers. For example it
will get the last 5 blog posts and it will get the top 5 most discussed
articles, and display it on the homepage. I will also have some
specific homepage modules being
2007 Jul 03
4
problems with acts_as_ferret
Hi,
I have i am trying to add a search feature to a ruby on rails blog, so
ive decided to use ferret. So far i have had quite a few problems with
it, from following a few tutorials i didnt really understand... i am at
the point where i can make a search and it returns the score of the
result. I want it to also show the title of the post and i think i have
implemented it correctly but it
2006 Jul 31
5
can someone explain RoR MVC from a C++ or Java perspective?
is a model similiar to a class? and active record is similiar to how
Java classes inherit from Object?
View is nothing more than an output of a model with HTML?
Controller is basically the Main part of the program?
--
Posted via http://www.ruby-forum.com/.
2006 May 22
2
good practice or waste of time?
I have what I hope is a simple question regarding a security practice
I''ve been using in my first Rails app. I want to know if it''s
worthwhile or if the extra typing isn''t worth it.
I have 3 models that are related to each other.
class User < AR:Base
has_one :library
end
class Library < AR:Base
belongs_to :user
has_many :items
end
class Item < AR:Base
2006 Feb 09
6
troubleshooting an observe_field
Hi,
I''ve got a live_search field in a partial that is on several different
pages. On all pages, except 1, it works fine. On the page it doesn''t work
on, it seems it never executes it action.
Here''s my observe_field code inside the partial:
<h1><label for="searchtext">Live Search:</label></h1>
<%= text_field_tag :searchtext
2006 Aug 18
1
Fragment Caching
Hello.
I wouldn''t mind getting some feedback about the use of fragment
caching. I''ve got a series of relatively expensive database queries
with their respective partials cached and everything is working fine.
The problem is that do get this to work I''ve had to move the database
queries from the controller into the view layer so as to avoid them
being called if the
2007 Aug 19
3
fastcgi issue on production
I just deployed my rails app to my production server. It''s all working
locally, but when I switched it over to the production server (at
dreamhost) I get this error:
# Logfile created on Sun Aug 19 15:22:48 -0700 2007 by logger.rb/
1.5.2.9
[19/Aug/2007:15:22:48 :: 1841] starting
[19/Aug/2007:15:22:48 :: 1841] Dispatcher failed to catch: You have a
nil object when you didn''t
2006 Jul 02
5
Pretty URLs -> Routes
Hi
I am having issues with getting my pretty urls to work.
routes.rb:
map.connect '':user'' , :controller => ''front'' ,
:action => ''list'' ,
:filter => ''user''
front_controller.rb:
def list
@advert_pages, @adverts = paginate :adverts, :per_page => 10
@user =
2006 Jan 31
4
has_one without inverse belongs_to
I have two models called entity and user.
The entities table has a column called users_id that contains the user
id of the user that created the entity.
In entity I have...
has_one :user
... as I want to be able to show the user who created the entity from
the entity object.
But this produces the following error...
Mysql::Error: #42S22Unknown column ''users.entity_id'' in
2015 Sep 11
2
rsync question
On Thu, 10 Sep 2015 22:50:47 -0400
Robert Moskowitz wrote:
> > That will use the default port on the remote host, you can override
> > that without specifying the -e if required using -p <port>.
>
>
> $ rsync -ah --stats --delete -p 613 root at 192.168.129.2:/etc/dhcp/
> /home/rgm/data/htt/httnet/homebase/new/dhcp
> Unexpected remote arg: root at
2010 Oct 27
4
Star Sonata: Great start, then crash when accepting missions
this is my first post and im not a tech wiz so if you need more info just ask (and tell me how to get it)...
I installed a new game called Star Sonata... and yes i had the little bug that made it so i couldn't make a keyboard input... i fixed that with Winetricks dinput8.dll... and for a few hours the game ran perfectly... then at a random point it crashed... and i thought it was for no