Displaying 20 results from an estimated 66 matches for "somethinglearned".
2006 Apr 11
11
I can''t get rails to see my plugin. How can I this?
I''m trying to produce a plugin to help me with my page caching woes. I
can''t seem to get rails to see my method within the plugin. This is my
first attempt at a plugin so I''m sure I''m missing something. I''ve
created a directory /vendor/lib/plugins/broom_stick/. I then created an
init.rb file with:
require ''broom_stick''
I then
2006 Feb 17
4
Table with Constants
I would like to have a table with some constants to use them later on
for a drop down menu. How can this be done?
My table looks like
Table with constants
------------------------
id | key | value | type
------------------------
1 | M | Male | sex
....
I know it can be done like this
<% select ''object'', ''method'', Constants.find(:all, :select =>
2006 Jun 01
3
rake create_sessions_table, does not create session table
when i run rake create_sessions_table, I get following output. tables
donot get created and my application doesnot start.
(in G:/rubysrc/blog)
create db/migrate
create db/migrate/001_add_sessions.rb
info: the first time ran take everyting was fine, but now i have
reinstalled ruby and rails and created the database, but i am unable to
create session table with rake, please help.
2006 Mar 01
5
validations without AR - going crazy trying to find link
Hi,
in the past few months someone posted an entry on their blog about
how to do validations in non-AR classes and I cant find it any more.
Anyone have a link?
Thanks,
Trevor
--
Trevor Squires
http://somethinglearned.com
2007 Sep 21
3
TextMate Bundle and exception when switching to alternate file.
...@@
def content_for(file_type, relative_path)
case file_type
- when ''spec'' then
+ when /spec$/ then
spec(relative_path)
else
klass(relative_path)
Thanks for your attention,
Trevor
--
--
Trevor Squires
http://somethinglearned.com
2006 Apr 19
8
Module and Model
I am getting the following error
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1129:in
`method_missing'': undefined method `directory?'' for Msg::File:Class
(NoMethodError)
I have a model called Msg::File in models/msg/file.rb, and I have a file
in lib/msg/helper.rb which references to both Msg::File and
File.directory?
How do I help activerecord
2006 May 24
1
Best practices: a little pop-quiz on my blog
...39;'s probably of interest to more than just the three
people (including my wife) that actually read my blog I figured it
would be okay to announce it here.
http://tinyurl.com/prxdl
I''ll post my answers in a followup tomorrow (Wednesday).
Regards,
Trevor
--
Trevor Squires
http://somethinglearned.com
2006 Apr 17
2
Understanding when flash gets reset (render vs. redirect_to)
All,
I have a controller action that will do a different "render (:action)"
call
depending on whether or not data is valid.
When the data is invalid - I set a flash element to hold a message.
However, when I post back to this controller action and have valid data,
I still have the flash element set, which I don''t want.
I believe this is because I did a render from the
2005 Dec 08
2
bounce effect
Hi,
I was wondering if anyone has seen (or completed) an effect to make
something ''bounce'' like icons do in the OS X dock when you launch
them? Something that looks like there''s a bit of gravitational
behavior to it?
Thanks,
Trevor
Trevor Squires
http://somethinglearned.com
2006 Feb 15
2
extending rails via /lib - problems
I wanted to group some functions which I use in some models in one
place. Controllers have application.rb and views have helpers but I
couldn''t find anything about models. Using the /lib directory seemed to
be the only way.
Alright... so I have something like this:
/lib/code.rb
class ActiveRecord::Base
def method_a(n)
.......
end
def method_b(n)
........
end
end
2006 Apr 17
3
Does render() have 2 be last statement in controller method?
I have a controller method that is attempting to do a render based on a
potential error condition.
So I have
if (condition)
render()
else
..other code
end
....other code in method
Should I expect the render to take place immediately or does the render
call not work because it isn''t the last statement in the method?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
2006 Mar 22
5
Class Caching Problem [was Newbie Question about Custom Classes]
So any other ideas as to why my custom class under app/models is being
cached even though all the caching is set to false in the
config/environments/* files? Currently I''m having to restart WEBrick
after EVERY change to the file. The controllers and views are
reloading just fine and not being cached. It''s just the custom class
I created that''s being cached.
Any ideas
2006 Jul 26
4
Execute code when an inheritance happens, or disabling STI
I am trying to inherit from a ActiveRecord class defined in a plugin.
The problem is that ActiveRecord thinks I am doing an STI and is looking
up a table that doesn''t exist.
Currently, I have a method in the parent class that looks like this:
def self.fix_table_name
class_eval do
set_table_name(Inflector.tableize(self.to_s))
end
end
The problem is that this method
2006 Mar 31
5
Model reloading problem
Hi all,
I''ve a model class Toto in the model directory.
I don''t understand why i have to restarts WebBrick to view changes i make
in this class
FYI : in the development. rb i desabled class cache with
config.cache_classes = false
Regards
Luciano
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Apr 20
5
strange mysql problem
i have this model:
class LineItem < ActiveRecord::Base
belongs_to :quote
end
in the console:
>>l = LineItem.create
ActiveRecord::StatementInvalid: Mysql::Error: You have an error in
your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near '' , , , )'' at line 1:
INSERT INTO line_items (`qty`, `quote_id`,
2005 Dec 11
7
Catching Exceptions in ActionController
I''d like to be able to catch ActionController::MissingTemplate
exceptions from within ActionControlle, *but*, MissingTemplate isn''t
defined within my controllers!!!
How is that possible - after all, all controller subclass
ActionController, so how are exceptions it defines not there!?
More importantly, how can I do this?
--
Posted via http://www.ruby-forum.com/.
2006 May 31
13
What are controller modules *for*?
I am aware that controllers can be placed in modules:
ruby script/generate controller modulename/controllername
But what does this buy me? Is it just a way of ensuring that my source
code is nicely arranged, or can I use the fact that a set of controllers
are all within a particular model to implement functionality common to
all of those controllers?
Why am I asking?
The app
2005 Nov 18
6
wrong number of arguments (2 for 1) error message help
All,
This is really starting to get me as i can''t figure out why I am
getting this error. Here is what is going on. I have a table called
items and a item controller. When I add a new item to the items table
I am also creating several associated tables. the code for this so
that you can follow along is:
def create
@item = Item.new(params[:item])
# The item belongs to
2006 Jun 08
5
update only the join table in a HABTM - how?
I have a photographers app that requires giving access to galleries for
users. in one part, I want to be able to define gallery access for a
user seperate from updating any of the user info. I have this function:
def edit_access
@user = User.find(params[:id])
@user.galleries = Gallery.find(params[:gallery_ids]) if
params[:gallery_ids]
if @user.update_attributes(params[:user])
2006 Jun 08
5
Suggestions wanted for non-logged-in user in closed beta phase
Will shortly be deploying first iteration of app to some beta testers
(i.e. friends), and want them to be able see it both from logged-in view
and guest (i.e. not logged-in) view. The two are a fair bit different.
It''s a closed beta, so (hopefully) no pages (other than a blank login
page) will be visible.
The question is, what''s the best way for them to be able to see (and