Displaying 20 results from an estimated 600 matches similar to: "User.new doesn´t capture all of the parameters"
2008 Jun 13
3
before_filter order of execution
Hi
I''m trying to use before_filter to allow access to a site. Only logged
in users can view any object in the controller, but only users with a
access_level higher than 2 can view specific objects. My code is:
-----------------------------------------------------------
IN USER_CONTROLLER
before_filter :login_required
before_filter :access_granted, :only => [:destroy, :new , :edit]
2006 Jun 05
2
When adding a record in console, a parameter comes in as null even when I set it
In console, I am trying to create a User but the :account_id does not come
in. Console just gives me back :account_id => nil. Obviously I''m trying to
set it though. Silly console...
But, I can set the account_id column in my controller like so:
@user = User.new(params[:user])
@user.account_id = account.id
@user.save
Here''s what I give to the controller:
User.create :name
2006 Mar 29
4
Collecting data from forms
Hi,
I?m having some problems collecting the content of some forms.
This is whats in list.rhtml:
<%= form_tag :action => ''send_message'' %>
From:
<%= text_field ''message'', ''from''%>
<br>Message:
<%= text_area ''message'', ''text'', :rows => 6 %>
<tr>
<td></td>
2006 Feb 11
7
Menu Helper
Hi all,
I''m trying to add a common menu to all pages in my application. It is
just a set of links I want to display. I''m having trouble deciding
where to put the code. Below is what I''ve tried to get out of the "Four
Days on Rails" tutorial but no luck. Any help would be appreciated. Am
I on the right track?
Thanks,
Sam
2006 Apr 11
5
Reading MySQL rows
Hi there,
I?m having difficulties reading the content of some rows in my database.
Tried to use some of the code at page 221 in the pickaxe, but didn?t
make it work.
The SQL query works fine directly against the database.
mysql> select id, count, company from users where name = "martin";
+----+-------+------------+
| id | count | company |
+----+-------+------------+
| 1 |
2006 Mar 06
5
Rails MySQL query
Hi,
I?m following the Depot tutorial in Agile Web Development with Rails.
I need some help to display products thats in one specific category.
mysql> select * from products where category = "jackets" does what I
want, but I?m not sure how to make a list and display it in rails?
This code displays every product with some of its fields, but I want
it to only display the products
2012 Jul 09
10
attr_accessible on some properties + attr_protected on others makes class 'open-by-default'
(I posted this as a bug in GitHub
(https://github.com/rails/rails/issues/7018), but then someone there told
me I should post it here, so here it is.)
If you set attr_accessible on some properties in an ActiveRecord-descended
class, and then attr_protected on others - the class becomes ''default-open''
- if any properties are missed or added later, they will be accessible by
2006 Jun 07
4
Question: coding protected methods
Apologies first, because I need to ramp up on Ruby and coding Ruby in Rails,
however it''s my 3rd day with this beast :) so I''m asking :
When I added protected methods to the model before it was like:
protected
method....................
end
Would this be a valid way to write a protected method as well ?:
attr_protected :column1, :column2
Perhaps this particular call
2006 Mar 11
2
Problems building mysql gem
Hi,
I?m having problems building and installing the mysql gem on a Fedora
Core 4 (Linux) server.
# gem install mysql
Attempting local installation of ''mysql''
Local gem file not found: mysql*.gem
Attempting remote installation of ''mysql''
Building native extensions. This could take a while...
can''t find header files for ruby.
ERROR: While executing
2007 Jan 26
7
How to protect attributes from being updated?
Hi!
I''m new to Rails!
Rails rox!
1 quesion so far:
I have :email attribute in User model.
I dont'' want :email to allow to be updated.
How do i do this with Rails?
Do I have to implement required validation manually?
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2006 Jul 08
2
Creating/Saving dependent objects
Folks,
Am new to RoR and am building an example to get myself familiar. I am
running into a simple issue while creating a user registration page.
I have a User and Address models defined as below (partial/relevant code
included below). User has_one address and Address belongs_to user. I have a
foreign key defined in address table that refers to user(id)
In a form I take in username, password,
1999 Apr 25
0
swat: bug located
Great job on SWAT. I'm a hard-core UNIX guy, and I like my vi and whatnot.
But it's nice to see a functional web interface. It could use some more
work--but great job so far! Anyway, I found a core-dump-causing-bug.
I was curious as to whether or not swat limited addition of passwords
to the smbpasswd file by the users that exist in the system's /etc/passwd
file. I was relativly
1999 Apr 25
0
swat core dump and debug information
(This may be a repost; but I was not subscribed to the list and looking
at the current archives the articles are not showing up.)
Great job on SWAT. I'm a hard-core UNIX guy, and I like my vi and whatnot.
But it's nice to see a functional web interface. It could use some more
work--but great job so far! Anyway, I found a core-dump-causing-bug.
I was curious as to whether or not swat
2005 Mar 07
3
exclude an attribute from save
Hi,
I''ve used .save to save the attributes, but on my table there is an
autoincrementing id (not the primary key) that doesn''t need to be
inserted... but save try to INSERT it anyway... is there a way to
avoid save from acting this way or to whisper him to be more polite
this time? ;)
Thanks,
Enrico
--
"The only thing necessary for the triumph of evil
is for good men to do
2006 Mar 29
6
Simply Getting Post Params
I am a complete Rails newbie and am trying to understand how I can
simply get the data from a password field in a form that is not mapped
to a field in the database.
The scenario is this. I have a User model that is mapped to a table
users with the following fields: username, email_address, password and
join_dt. Following pretty closely to the login section in the Agile Web
Development with
2007 May 30
9
Specify attr_protected
This is kind of a two part question.
Question One: I want to be sure that an Order model is protecting
sensitive attributes from mass assignment.
The example looks like this:
describe Order do
it "should protect total attribute from mass assignment" do
@order = Order.new(:total => 0.05)
@order.total.should_not == 0.05
end
end
And the code to implement it:
class Order
2006 Mar 22
3
STI and ActiveRecord attributes unprotected
Hi,
This does not seem to be covered anywhere. Since base class extends
ActiveRecord with a table that has fields for all heirs, would that mean
that any heir class can access any of those attributes, including ones
that belong to other heirs?
Or I am missing something?
--
Posted via http://www.ruby-forum.com/.
2005 Dec 17
1
lost in an ActiveRecord::StatementInvalid
I have an error I don''t know how to debug. I am adding the login
suport in Depot (the example in the RoR book) and
LoginController#add_user throws ActiveRecord::StatementInvalid in an
innocent /login/add_user GET request.
The trace goes down to a call to SQLiteAdapter#table_structure, and
the source code suggests what''s happening is that "PRAGMA
2005 May 17
2
Noob - ActionView::Helpers::FormOptionsHelper::select
Hi,
I''m just starting with Rails and i''m trying to do something like this:
<%= start_form_tag :action => ''add_user'', :id => @social_event_group %>
<%= select ''user'', ''id'' , User.find_all.collect {|u| [ u.login, u.id ]
}%></p>
<%= submit_tag "Add User" %>
<%= end_form_tag %>
2004 Mar 01
0
RE: win32etc test failure
Ok - time for me to patch and update the docs! Thanks for the testing!
Dan
-----Original Message-----
From: Date, Shashank [Non-Employee]
[mailto:Shashank.Date@mail.sprint.com]
Sent: Monday, March 01, 2004 10:02 AM
To: Berger, Daniel
Subject: RE: win32etc test failure
I like your approach better: allow me to be lazy (so I am not _forced_
to give it) but forgive me if I do ;-)
It worked