Scott Kulik wrote:
> is there a way i can get a rake task to destroy the dependents declared
> in the model when an item is destroyed?
>
> here is my rake task code:
>
> task(:deleteFakes => :environment) do
>@items = Item.find(:all, :conditions => 'items.fake = true', :order
> => 'name')
>
is there a way i can get a rake task to destroy the dependents declared
in the model when an item is destroyed?
here is my rake task code:
task(:deleteFakes => :environment) do
@items = Item.find(:all, :conditions => 'items.fake = true', :order
=> 'name')
@items.each do |item|
item.d
On Sat, Sep 12, 2009 at 4:11 PM, Frederick Cheung
wrote:
> The default in production mode is not to log SQL queries, so the lack
> of queries in the log is likely a red herring.
And of course, you can configure MySQL to log queries for you to
examine separately.
You might also review whether y
FYI, to add some metrics here, I have a list of cities-in-states that I
sourced from somewhere (US Census site, probably), and that list has
55,324 entries. So loading this into a select box, even dynamically,
seems problematic. As the previous poster suggested, use AJAX-based
autocomplete t
On Sep 12, 2009, at 6:00 PM, Daniel Lopes wrote:
>
> I know I can open or access private methods in runtime, but you
> doesn't think this method is a good thing to be public?
I've personally never understood the rationale for making this method
private. I've had to use it for custom asset-ma
http://guides.rubyonrails.org/form_helpers.html
On Sep 12, 7:38 pm, MS999 wrote:
> Hi,
> How do you add a new line using RoR?
> What do I need to add to link_to to make it open a new page?
>
> Thank you
--~--~-~--~~~---~--~~
You received this message because you
I know I can open or access private methods in runtime, but you
doesn't think this method is a good thing to be public?
On Sep 11, 11:21 pm, "s.ross" wrote:
> Is it possible for you to do something like this:
>
> def explicitly_compute_public_path(source, dir, ext = nil,
> include_host = true)
Simpler yet, go to
http://guides.rubyonrails.org/getting_started.html
and search for link_to.
On Sep 12, 7:38 pm, MS999 wrote:
> Hi,
> How do you add a new line using RoR?
> What do I need to add to link_to to make it open a new page?
>
> Thank you
--~--~-~--~~~-
Hi,
How do you add a new line using RoR?
What do I need to add to link_to to make it open a new page?
Thank you
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, se
Quoting jason :
>
> So this is weird. I have this in one of my controllers:
>
> f = open("http://www.google.com";)
>@s = f.read
>
> And that's fine. I can echo @s back out in the view, and it works like
> a charm. But the second I do this (in the controller):
>
> doc = Hpricot(@s)
> What's the best way to implement API versioning in rails?
>
With routing.
Start off with api.startup.com/v1/session/create, then move on to
api.startup.com/v2/session/create, etc.
- D
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You receiv
On Sep 12, 9:32 pm, tispratik wrote:
> Role Model:
> =
> create_table :roles, :id => false do |t|
> t.integer :user_id
> t.integer :modul_id
> t.string :role
> end
>
There's your problem - rails expects your model to have a primary key;
your one doesn't
Fred
> Mod
On Sep 12, 10:31 pm, Eric Gruber wrote:
> Any ideas?
>
The default in production mode is not to log SQL queries, so the lack
of queries in the log is likely a red herring. The request is getting
processed and rendering something - did you try using something like
firebug to see in what way the
So this is weird. I have this in one of my controllers:
f = open("http://www.google.com";)
@s = f.read
And that's fine. I can echo @s back out in the view, and it works like
a charm. But the second I do this (in the controller):
doc = Hpricot(@s)
I get an error 500 (internal server
Hi,
Does anyone know where I can find a full step by step tutorial on Many
to Many Relationships with Rails or can describe the steps in
inserting data into the join tables, displaying the connections, etc..
- I don't only need the model, but all the steps that you would use in
the MVC architectur
On Sep 11, 8:02 am, bingo bob
wrote:
> How to do? I'd really appreciate a worked example.
>
http://tinyurl.com/ppxf8e
--Matt Jones
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To pos
On Sep 11, 4:44 am, Erwin wrote:
> just installed 2.3.4,
> and launched a simple script/console ... got errors, both in 2.3.4
> libs...
> --
> $ script/console
> Loading development environment (Rails 2.3.4)
>
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/
> i18n_
And with fresh morning eyes, I solved that too.
(T'was another concept where it should have been part -- another
victim of copy-pasting controller code.)
s.
On Sep 13, 7:22 am, steven_noble wrote:
> I'm an idiot. Perils of copy-pasting controllers and then starting at
> them cross-eyed at 11pm
On Sep 12, 12:18 am, Salil Gaikwad
wrote:
> Hello all!
>
> I need to a implement a sign-up form with US states and city selector.
> Is there already a helper os something that
> implements or makes it easier to implement this for Rails.Also when i
> select the state all the city appears for t
Any ideas?
On Sep 11, 1:25 pm, "Eric J. Gruber" wrote:
> I've got a very small app that uses ajax for a live preview. On my
> development machine (using sqlite3), it works just fine. Here is a
> sample of the log with a known good query:
>
> development.log
> ---
> Processing
I'm an idiot. Perils of copy-pasting controllers and then starting at
them cross-eyed at 11pm (local time).
I made the two changes above (@concept and []) and it took the process
forward. But now when I save, it seems to be trying to create a
project as well as a part, as it runs my new project v
Colin, You nailed it. Working great in my app - lovely.
Many thanks indeed for your help.
Rupert
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
2009/9/12 bingo bob :
>
>
> Interesting closer i think...
>
> I'm dojng this currently...(sure I know this is better in the controller
> ultimately).
>
> <% @advert_types_sorted = @adverts.group_by { |advert|
> advert.advert_type.position }.sort %>
> <%= p @advert_types_sorted.inspect %>
>
>
actually scrub that, dont think the number is the ID of the advertype
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, sen
Interesting closer i think...
I'm dojng this currently...(sure I know this is better in the controller
ultimately).
<% @advert_types_sorted = @adverts.group_by { |advert|
advert.advert_type.position }.sort %>
<%= p @advert_types_sorted.inspect %>
<% @advert_types_sorted.each do |type
2009/9/12 bingo bob :
>
>
> ok i did this...
> <%= p @advert_types.inspect %>
>
> and got this
>
>
> "# description: \"Accommodation\", created_at: \"2009-08-30 10:20:38\",
> updated_at: \"2009-08-30 10:20:38\", position: 2>=>[# advert_type_id:...SNIP,
>
> # and Restaurants\", created_at: \"2009-
Role Model:
=
create_table :roles, :id => false do |t|
t.integer :user_id
t.integer :modul_id
t.string :role
end
Modul Model:
==
create_table :moduls do |t|
t.string :name
t.integer :updated_by
t.timestamps
end
--~--~-~--~~-
Hi,
I have a Modul model and a Role model. Each modul can have many roles.
So when the modul is deleted, it should delete the roles also.
I have the following in my Modul model:
has_many :roles, :dependent => :destroy
When i run some_object.destroy from the console, i get the following
error:
If the app is slow, how "slow" is slow? 2s a page or 10s for a page?
Now you have to look at what is slow. Is it page render? is it the
database?
If its page render you will have to look at caching.
If its database you need to optimize the database. Add indexes and
tune the database. Are you usi
ok i did this...
<%= p @advert_types.inspect %>
and got this
"#=>[#=>[#http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email
2009/9/12 bingo bob :
>
> 24: <% else %>
> 25:
> 26:
> 27: <% @advert_types.sort_by { |t| t.position } %>
Firstly it would be much better to do this in the controller, or even
better in a method of one of the models. Secondly sort_by does not
modify the array (@advert_types in this case) it
24: <% else %>
25:
26:
27: <% @advert_types.sort_by { |t| t.position } %>
28:
29: <% @advert_types.each do |type, adverts| %>
30:
Showing app/views/resorts/show.html.erb where line #27 raised:
undefined method `position' for #
--
Posted via http://www.ruby-forum.com/.
--~--~-
Nobody?
Ok maybe I'm asking the wrong question:
Has Rack come up with a way to handle uploads in a way that scales
well without emptying the rails thread pool so that nobody is even
using mod_porter?
On Sep 11, 11:00 am, "reube...@gmail.com" wrote:
> I'm trying to set up an upload interface t
2009/9/12 bingo bob :
>
> bingo bob wrote:
can't get this to work though @advert_types.sort_by { |t| t.position }
>>
>>> Not much to expand, what happens when you do it?
>>
>> I get this...
>>
>> undefined method `position' for #
>
> Which figures as an array wouldn't have a position the Adve
Thanks Fred. That solved my problem.
I Installed version 2.3.3 and then I had to rebuild the application
from scratch, because only changing the variable RAILS_GEM_VERSION in
environment.rb, still gave me the error pasted bellow, of a missing
method, I guess, when I started the WEBrick server.
The
Thanks Fred. That solved my problem.
I Installed version 2.3.3 and then I had to rebuild the application
from scratch, because only changing the variable RAILS_GEM_VERSION in
environment.rb, still gave me the error pasted bellow, of a missing
method, I guess, when I started the WEBrick server.
The
On Sat, Sep 12, 2009 at 11:09 AM, jhaagmans wrote:
> However, isn't there a "fastest" setup?
IMO, no; performance tuning is pretty much always "it depends" :-)
e.g. Apache vs. nginx? any differences in web server speed may be
irrelevant in the face of poorly indexed DB tables. And the indexes
bingo bob wrote:
>>> can't get this to work though @advert_types.sort_by { |t| t.position }
>
>> Not much to expand, what happens when you do it?
>
> I get this...
>
> undefined method `position' for #
Which figures as an array wouldn't have a position the AdvertType does
though.
--
Posted v
>> can't get this to work though @advert_types.sort_by { |t| t.position }
> Not much to expand, what happens when you do it?
I get this...
undefined method `position' for #
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this messa
Thanks!!
@user.password = Digest::SHA1.hexdigest(@user.password) if
> @user.valid?
works perfectly!
thanks a lot!!
On 12 Sep, 09:54, Sijo Kg wrote:
> Hi
> You can solve it like
>
> @user.password = Digest::SHA1.hexdigest(@user.password) if
> @user.valid?
>
> Change on
Great, thank you both.
However, isn't there a "fastest" setup? Is there any documentation on
whether it's best to go with Passenger/Apache, Passenger/nginx,
Mongrel or something like that? Even the most simple applications are
relatively slow and that shouldn't be.
--~--~-~--~~---
If like me you spend hours trying to figure out why timezone is not
working at all, check if you have a :time column instead of a
:datetime. !...@%...
Sorry for the noise.
On Sat, Sep 12, 2009 at 6:24 PM, Fabien Penso wrote:
> I'm trying to understand why I can not make time_zone working. It
>
hi,
I'm trying to understand why I can not make time_zone working. It
always return the same date whatever time_zone I configured :
>> Time.zone
=> #
>> User.first.silent_mode_at
=> Sat Jan 01 22:00:00 UTC 2000
>> Time.zone="Hawaii"
=> "Hawaii"
>> User.first.silent_mode_at
=> Sat Jan 01 22:00:00
2009/9/12 bingo bob :
>
> yes to the adverts in plural - my mishtake.
>
> can't get this to work though @advert_types.sort_by { |t| t.position }
>
> mind expanding the example?
Not much to expand, what happens when you do it?
Have you met ruby-debug? I find it invaluable when some code is not
do
On Sep 12, 5:00 pm, LF wrote:
>
> This is the default view generated. I haven't touched it yet. What is
> this problem? Do I need to install something else? Am I doing anything
> wrong?
> I'm sorry if this is a basic one, but I tried everything (which is
> very little) I know. Anybody can help m
Hi guys.
I'm a freshman on Rails (and Ruby) so I'm sorry if my question is
pretty basic, and possible has a vary basic answer. I tried to Google
this problem, but a couple of hour after and no solution found, I
decided to ask for help here.
I have installed ruby 1.9.1p243, Rails 2.3.4, Gem 1.3.5
yes to the adverts in plural - my mishtake.
can't get this to work though @advert_types.sort_by { |t| t.position }
mind expanding the example?
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
On Sat, Sep 12, 2009 at 4:39 AM, prashanth hiremath
wrote:
> i have First Second Third
FYI, that sample is bad XML -- second span isn't closed.
> i wanna remove first and second span tags how can i achieve it help me
>
> OUTPUT:
>
> Third
I would probably use Nokogiri for this rathe
2009/9/12 bingo bob :
>
>
>>
>> show view extract
>>
>> <% @advert_types.each do |type, advert| %>
Should that be adverts not advert?
>> <%= type.name %>
>> <% advert.each do |advert| %>
adverts.each ?
>> <%= render :partial => 'adverts/small_advert_for_side_panel',
>> :locals
>
> show view extract
>
> <% @advert_types.each do |type, advert| %>
> <%= type.name %>
> <% advert.each do |advert| %>
> <%= render :partial => 'adverts/small_advert_for_side_panel',
> :locals => { :advert => advert } %>
> <% end %>
>
I've realised what I need to do her
On Sat, Sep 12, 2009 at 2:23 AM, Rimantas Liubertas wrote:
>> Is there more I can do to ensure I at least get my apps running as
>> fast as possible?
> First thing you should do is to measure — profile your app and find
> which parts are slow.
+1 -- guessing doesn't cut it :-)
One excellent o
Hi Fraser,
On Fri, 2009-09-11 at 14:48 -0700, Fraser wrote:
> However, this doesn't offer the usual convenience of working with
> Rails models. I can't easily express a has_many relationship with the
> user and make use of
>
> current_user.sessions
>
> nor can I easily put an index on user_
That makes sense!
Thanks for that!
On Sep 11, 7:33 pm, pharrington wrote:
> On Sep 11, 12:12 pm, Gavin wrote:
>
> > When writing Ruby you have the option to end the file early with
> > __END__. Anything after the __END__ is assigned to a constant called
> > DATA which is available within the
Hi.
What's beautiful about Rails is that it provides the incredibly easy
system for API building.
At the same time once you grow and production test the application you
start finding that you can make the API interface even better. But you
have to break backward compatibility.
How do you handle
I am stupid and bad writer ...
Mysql.get_client_info
NoMethodError: undefined method `get_client_info' for Mysql:Class
from (irb):3
it happens because I wrote the bad method, should have written :
Mysql.get_client_info
=> "5.1.38"
On 11 sep, 17:26, AndrewO wrote:
> Your test works fo
Thanks Michael... I've set it up now.. (don't worry I had a back on
a clone disk.!! just in case)
installed the MySQL 5.1.38 (x86_64) and gem mysql (x_86_64)
all my gems are up and running now (rubygems 1.3.5, Rails 2.3.4, Ruby
1.8.7... I even installed Ruby 1.9 for testing purposes...)
2009/9/12 steven_noble :
>
> When I click the Save in /views/parts/new.html, I expect to end up on /
> views/parts/show.html, but instead I end up in /views/projects/
> index.html, with the wrong [flash] message.
>
> I have:
>
>
> /models/project.rb
>
I feel your pain. Having switched from Windows to OS X I thought that
such issues were behind me. I felt that Apple hid behinds their terms
a little with this upgrade.
Whilst I agree with Robert Walker's comments on 'it's your
responsibility' I still feel that Apple dropped the ball slightly on
t
Hi --
On Sat, 12 Sep 2009, steven_noble wrote:
> def create
> @project = Project.find(params[:project_id])
> @part = @project.parts.build(params[:concept])
> @part.user_id = @current_user
>
> respond_to do |format|
> if @concept.save
Should that be @part.save
Hi --
On Sat, 12 Sep 2009, steven_noble wrote:
Theory number two:
> form_for(@project, @part) do |f|
Try this:
form_for([...@project, @part]) do |f|
(i.e., put them in an array).
Theory number one still applies, though, in case you run into further
trouble :-)
David
--
David A. Black
Ahum, never mind. I was using a faulty example for triggering a
worker.
On 12 sep, 15:30, jhaagmans wrote:
> Hi,
>
> I'm trying to get backgroundrb working for one of my apps. I've
> installed it as a plugin, got a problem with not being able to find
> packet_finder_runner out of the way, genera
OK, following on - I did it, but I have another problem now..
here's some code...
advert.rb
default_scope :order => "adverts.created_at DESC", :limit => 100
named_scope :cleared_for_release, :conditions => ['cleared_for_release
= ?', true]
has_and_belongs_to_many :resorts
belongs_to
Hi,
I'm trying to get backgroundrb working for one of my apps. I've
installed it as a plugin, got a problem with not being able to find
packet_finder_runner out of the way, generated a worker, restarted
backgroundrb and when I'm calling that runner from one of my
controllers, the log says "no suc
When I click the Save in /views/parts/new.html, I expect to end up on /
views/parts/show.html, but instead I end up in /views/projects/
index.html, with the wrong [flash] message.
I have:
/models/project.rb
has_many :parts
/mo
Hi everyone,
My goal is to allow users of a Rails web app to see all their open
sessions on other computers and close/sign out of them remotely.
Similar to gmail's "Account activity" page (link found at the bottom
of the gmail inbox page).
I can technically achieve this by using the sessions in
Hi
M getting some problems in remove the span tags
i have First Second Third
i wanna remove first and second span tags how can i achieve it help me
OUTPUT:
Third
I have an hpricot syntax so that i can remove all the span tags i unable to
remove it
Regards
Prashanth
--~--~---
Hi --
On Sat, 12 Sep 2009, elioncho wrote:
>
> Hi guys,
>
> I am currently trying to clean up my views. As you can see in the
> example below, I'm having a new link to create a new resource
> dynamically. The controller is given by the params[:controller]. This
> way I create new action paths to
I have this code sample which doesnt work properly.
<% @advert_types.each do |at| %>
<%= at.name %>
<% @resort.adverts.cleared_for_release.each do |advert| %>
<%= render :partial => 'adverts/small_advert_for_side_panel',
:locals => { :advert =>
> Is there more I can do to ensure I at least get my apps running as
> fast as possible? (even though it might never be as fast as PHP was
> for me)
First thing you should do is to measure — profile your app and find
which parts are slow.
Then you may look into the cause of it and what can be don
Hi,
I've recently been working on a social networking site developed in
Rails. Even though it wasn't very well developed (I only had to do
some minor modifications and most of the code was written back in
2006), I noticed it was a bit on the slow side. Even in production
mode.
Now apart from the
Hello!
Try to look at authlogic plugin for user authentication:
http://github.com/binarylogic/authlogic/tree/master
Its really cool!
> if password.include?(" ")
> errors.add(:password, "Must be filled in")
why??
for saving crypted password in database use before_create callback
class Us
Hi
You can solve it like
@user.password = Digest::SHA1.hexdigest(@user.password) if
@user.valid?
Change only the above line .
What happens in your code is empty string also gets digested So
fails validation.
Sijo
--
Posted via http://www.ruby-forum.com/.
--~--~-
Hello,
I am working through the railsspace tutorrial, and i've noticed that
the password validation is no longer working.
I can get screen_name and email to validate, but for some reason, the
password field is ignored...
here's what i have so far:
within user.rb file
PASSWORD_MIN_LENGTH = 4
I found this and it worked:
:id => instance_variable_get("@#{params[:controller].singularize}")
One more thing though. When I try to do the link_to dynamically, I
generated the link_to urls using the url_for method. Is there any
other way to generate this routes dynamically without using the
url
Hi guys,
I am currently trying to clean up my views. As you can see in the
example below, I'm having a new link to create a new resource
dynamically. The controller is given by the params[:controller]. This
way I create new action paths to all my resources with the same code.
I want now a simila
See if this helps !
http://railscasts.com/episodes/88-dynamic-select-menus
Dave
On Sep 12, 12:18 pm, Salil Gaikwad
wrote:
> Hello all!
>
> I need to a implement a sign-up form with US states and city selector.
> Is there already a helper os something that
> implements or makes it easier to
76 matches
Mail list logo