Displaying 20 results from an estimated 4000 matches similar to: "RoR VS Rails ???"
2010 Aug 10
3
ActiveRecord::UnknownAttributeError: unknown attribute: <script type
Has anyone seen this happening to their apps?
I''m starting to get errors like this come across from one of my apps:
ActiveRecord::UnknownAttributeError: unknown attribute: <script type
The parameters being sent are:
{"user"=>
{"email_confirmation"=>"someone-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org",
2006 Apr 10
4
Many To Many''s Join table attributes + migrations
Hi all,
just joined and have only just kicked off with Rails (coming, but not
departing, from WebObjects development). And so far there seems to be
a lot of promise except for one thing I can''t figure out as yet --
the above problem.
Say I have the following conceptual relationships:
ITEMS <<--->> CARTS
i.e., each item can belong to one or more categories. So really
2006 Apr 24
12
Design Decisions
Hi All,
I am doing some research on how people start with their Rails app.
What design decisions are made and how is it build.
For example:
- do you use scaffolding and go from there? Or do you create everything
from scratch?
- are you using multiple controllers? Or do you put everything in one?
- do you use migrate?
- how do you use migrate? Do you call migrate your self or do you use
the
2006 Mar 16
6
Sessions or lookups?
My application needs to know if a user is an administrator, for security
and aesthetic reasons. At the moment, I store true/false in the session
by doing the following at login:
session[:user_is_admin] = authenticated_user.is_admin?
Is this OK to do? Or should I really be doing the following every time:
User.find(session[:user_id]).is_admin?
(user_id is always in the session too)
Is there
2006 Mar 21
2
Validation to make sure associations don''t change?
I have a main form representing the model, let''s call that ''Order'', and a
partial displaying its'' OrderLines.
I use the bulk update methods to initialize model objects directly from form
data, leaving validation of business logic to the model. As AR likes to
write stuff before i do an explicit save, I wrap the whole update in a
manual transaction.
This works
2009 Jun 09
3
protect_from_forgery doesnt protect from forgery
Maybe I am grasping the full usage of this protect_from_forgery
function, but it does not seem to work for me. Imagine the following:
A simple website with a user that needs to log in to do certain stuff
and a closed off admin section that only certain users can access that
have the is_admin field set to true.
So to be clear, my User model has a login, password and is_admin.
When displaying the
2006 Aug 10
6
save without commit ?
How do I get ''save'' to execute without commit?
I have tried:
ActiveRecord::Base.connection.begin_db_transaction
# do some stuff that doesn''t issue a database COMMIT statement
# then:
@myObject.save
# this issues a COMMIT but it shouldn''t! Shouldn''t it wait until I''ve
called:
ActiveRecord::Base.connection.commit_db_transaction
?
what am
2006 Mar 30
6
Global Method Declaration?
Is there a place where I can put a method that can be accessed in both
views and controllers?
Here''s the situation, maybe someone can suggest a better way to go about this:
I created my own custom login system with email verification and user
roles (basically, I tinkered around with SaltedHashLoginGenerator
until I finally gave up and wrote my own). One role, of course, is an
admin
2006 Apr 21
13
Sorttable.js
I have come across this neat Javascript table sorter at
http://kryogenix.org/code/browser/sorttable/
It seems straigh forward to use but i cant get it to work.
I have included in the head
<script src="javascripts/sorttable.js" type="text/javascript"></script>
In the View
<table class="sortable" id="anyid">
<thead>
2007 Dec 08
3
Uploading photos using facebook & attachment_fu
Hi All,
I''m trying to use a form to upload a photo that I will save using
attachment_fu. I''m very new to Facebookr so I apologize if this is covered
somewhere, but I''m kind of stumped.
Here''s what I''m doing now:
<% facebook_form_for(:my_object, :url => { :action => ''upload_photo'', :id =>
params[:id] }, :html => {
2010 Mar 24
2
Mock "Consent_6335" received unexpected message :marked_for_destruction? with (no args)
I have a mock object (Person) that is associated with another object
(my_object) through a belongs_to association. When I check whether
my_object is valid (my_object.should be_valid), I am getting an error
like the following:
Mock "Person_6338" received unexpected
message :marked_for_destruction? with (no args)
Checking the list of methods on the mock,
2005 Dec 17
2
Storing an object in the db
I''ve asked this before, but never got a working response. I''d like to
store an object inside a binary field in my db. So I''d have a class
like this
class MyAwesomeClass
def do_something_awesome
...
end
end
then
class MyRecord < ActiveRecord::Base
end
the table my_record would have a binary field, my_object, that would
store an object of
2005 Mar 10
8
Login controller additions
I have added roles and roles_users table and updated the model so that
my users can have multiple roles.
("Admin" role does always have id = 1).
I have added these methods to my application controller.
<code>
helper_method :is_admin?
helper_method :is_user?
def is_admin?
if @session[''user'']
@session[''user''].roles.find(1)
2009 May 29
1
assert method is not visible?
Hi,
test "is_admin method is not visible" do
get :is_admin
assert_???
end
is_admin is protected and should stay that way forever. What assertion
do I use?
M.
--
Posted via http://www.ruby-forum.com/.
2010 Jul 15
2
Authlogic admin user functionality
I am using authlogic as a authentication engine in my rails app.
I have two types of users 1) Users who are registered and has access
to there own profile.
2) Admin user who has access to everybody''s profile
In the user table i have a :is_admin field boolean field which defines
the admin user.
like the current_user method, Is there a way authlogic provides which
can tell me if the
2006 Jan 27
20
bundled_resource v.0.9
Original announcement at http://blog.inquirylabs.com/ [1]
== What is bundled_resource? ==
If your development is in any way similar to mine, there are a number
of useful resources out there that make web applications shine
beautifully. For example, there?s the Dynarch calendar and the
textarea tools. There are a number of others?too many, in fact. The
problem is that as a web developer,
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 Feb 20
3
file_column and login_engine incompatibilities
Hi, has anyone come across any incompatibilities between file_column and
login_engine?
I''ve been having strange issues where a User model with file_column in
it is failing to save the images properly. Everything uploads to the tmp
dir fine, but then it never gets copied to the proper permanent location.
No errors - everything happens fine except for that final part.
I have
2005 Aug 15
5
Customized Autocompletion
In the customized autocomplete demo, how does it know what content to
use as the value of the autocomplete?
The returned UL has the name, email address and an image. Yet only the
name is used.
How does it do this? I''ve been trying to get something similar going all
morning with little success.
Also, what does :skip_style=>true do? I couldn''t seem to find a mention
of it