[Rails] Re: IDE

2012-10-03 Thread Agoofin
I think Aptana is the best from what I've seen. Good git integration and 
built it command console.

On Wednesday, October 3, 2012 1:33:30 PM UTC-4, Avi wrote:

 Hello,

 What is the best IDE for ROR with JRuby,
 Currently I am using Aptana Studio. I am trying to use Rubymine.
 Which IDE would give better support to debugging ?
 Any Suggestions?

 Is there any problem to keep both JRuby  ruby versions ?


 Thanks.


-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/5JupnoaPPXgJ.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: How can I copy records from one table to another?

2012-08-13 Thread Agoofin
How many records are you talking about?

For a few records, once in a while, you could do it in Ruby - Google using 
ActiveRecord outside of Rails for some more info.

Why do you have deleted tables? You might consider adding a field like 
Active and filter the non active records

On Monday, August 13, 2012 10:42:10 PM UTC-4, ZeroModulus wrote:

 For every table in my app there is a corresponding deleted_.* table. I 
 would like to be able to copy a record to its corresponding deleted_.* 
 table. How might I achieve this?

 If I have to have models for a deleted record, could I use some 
 metaprogramming magic to create these models? How would I do that if so?


-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/fvDlEkHRflsJ.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: is there any Time function to gat a duration from string ?

2011-07-10 Thread AGoofin
You could convert the string to a time object and pick out the
specific parts you want. This might come in handy if you want to store
the time in the database at some point.

http://api.rubyonrails.org/classes/Time.html

On Jul 10, 11:47 am, Erwin yves_duf...@mac.com wrote:
 I tried :
 output = 00:00:03.10

 output.split(':').inject(0){|a, m| a = a * 60 + m.to_f}
  = 3.1

 is there any better way ?

 On Jul 10, 5:37 pm, Erwin yves_duf...@mac.com wrote:







  I get a string back from ffmpeg :  00:00:03.10    ( hh:mm:ss )
  which class should I use to get it converted into  3.10 sec ( float)

  thanks for your feedback

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Display picture on the screen

2011-06-12 Thread Agoofin
Instead of trying to re-invent the wheel, or a picture of that wheel,
take a look at Paperclip or Carrierwave. Both are plugins that make
storing and displaying pictures simple.

I would recommend as well to use a file system storage solution
depending on the scale of the project

On Jun 12, 10:51 am, joanne joanne0...@gmail.com wrote:
 thanks i found the way to display the picture on the screen by using
 sent_data method to convert link

 On Jun 11, 10:45 pm, Hassan Schroeder hassan.schroe...@gmail.com
 wrote:







  On Sat, Jun 11, 2011 at 7:17 PM, joanne ta joanne0...@gmail.com wrote:
   Hi,, do you have any other options for me.. cuz i really have to do in 
   this

  Then write a controller to fetch the image data from the DB and deliver
  it with the appropriate content-type.

  Put the URL of that controller/image in your HTML as the image source
  attribute.

  That's it. Best of luck!

  --
  Hassan Schroeder  
  hassan.schroe...@gmail.comhttp://about.me/hassanschroeder
  twitter: @hassan

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Carrierwave Is Not Loading RMagick

2011-06-12 Thread Agoofin
Rails on Windows is a painful process isn't it?

I had some dealings with rmagick which were mitigated by using
Paperclip.

I did find this though -
http://stackoverflow.com/questions/5811388/imagemagick-core-rl-magick-dll-not-found-or-how-to-install-rmagick-on-window

Hope this helps

If you have the computer horsepower (Virtualbox) or the ability to
dual boot - get a Linux distro to develop with.

On Jun 11, 10:11 pm, andrewperk andrewp...@gmail.com wrote:
 Hello, I'm using Carrierwave to upload images. I'm on windows vista
 using ruby192. I've downloaded the windows versions of imagemagick and
 rmagick and followed the instructions in the readme. I have set my
 path variables to my installations.

 I can access identify in the command line so I know imagemagick is
 working. I can even convert in the command line.

 But when I start my server and try to access my application in the
 browser I get:

 no such file to load -- RMagick

 When I type gem list in the CLI it shows I have rmagick installed:

 rmagick (2.12.0 mswin32)

 Is this maybe because I don't have rmagick in my gemfile? Is there a
 way to make my gem file use this specific version of rmagick for
 2.12.0 mswin32? Because when I put just

 gem 'rmagick'

 and run bundle I get errors, I think I need to tell it to include this
 specific gem because its for windows.

 Thanks for any help.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: How to display picture on rails

2011-06-11 Thread Agoofin
Here's how I display images with paperclip:
  % if items.picture.url(:medium) =~ /missing.png/ %
%= link_to image_tag( items.picture.url,:size =
'300x300', :border= 0), items.picture.url, :target = '_blank' %
  % else %
%= link_to image_tag( items.picture.url(:medium), :border= 0),
items.picture.url, :target = '_blank' %
  % end %

Notice the image tag - items.picture.url not the base object.

Hope this helps.

On Jun 10, 12:11 pm, joanne ta joanne0...@gmail.com wrote:
 in view:
 %...@patient.image  %

 in controller

    @user=Picture.all(
          :joins = :culture,
                   :conditions = (Phrase.joins(:description))).first

 and it shows this on the screen,

 GIF89a     ý f * zd :2eZJ R ̙ ݼ iZA:0 ޙ B ||| ^R c Ͼ ϫthS

 if i use == %=image_tag(@user.image)  % it will error me string contains
 null byte

 give help.. thanks









 On Fri, Jun 10, 2011 at 11:47 AM, Colin Law clan...@googlemail.com wrote:
  On 10 June 2011 16:40, joanne joanne0...@gmail.com wrote:
   Hi all,

   I want to display the picture(BLOD type in sqlite3 in Ubuntu)
   I cannot display picture on the screen., i just show some decode
   stuff.

  It is no good just saying you cannot display it and you get some
  'decode stuff'.  Show us the code you have written that you think
  should display the picture and whatever is shown on screen where the
  image should be displayed.  First have a look at the html being
  generated (View  Page Source or similar in your browser) and make
  sure that the html being generated is what you expect.  I would expect
  you to be using image_tag to show the image.

   and i try to use the plug in  paperclip..
   and when i install it on the current project,, I cannot run my server
   in Terminal,,

  Is this a separate question?  If so I would advise just having one
  question in a post, otherwise the answers to the two questions will
  get mixed up.  Again though it is no good just saying you cannot run
  the server, otherwise the only reply you will get is that you are
  doing something wrong.  Tell us the error message when you run the
  server.

  Colin

  Colin

  --
  You received this message because you are subscribed to the Google Groups
  Ruby on Rails: Talk group.
  To post to this group, send email to rubyonrails-talk@googlegroups.com.
  To unsubscribe from this group, send email to
  rubyonrails-talk+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.

 --
 

 Thank you,

 Yen

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Basic database question

2011-06-11 Thread Agoofin
There are some good books about beginning Rails development - even
some of those geared toward Rails 2 will give you a basic
understanding of the model view controller theory which is Rails.

Don't be afraid to try things as well, you'll learn a lot more this
way.

On Jun 9, 3:06 am, Sta Canovist stacanov...@gmail.com wrote:
 Hi there
 Yes, I know very little of ruby. I must take a crash course?
 Probabily.
 Anyway, I try to ask this here.

 I have a control: customer_controller.
 From here, I can do something like:

 @id = 1
 @customer = Customer.find(id)

 Now @customer will contain all the fetched record for customer with id
 = 1. Great.

 From this controller I will render an html page. Somewhere the view
 will print test. SOmething like:

 This is your account

 But I want to fetch this text from the database.
 The customer table also have a field named lang.
 Having a table called page_texts I want from customer_controller,
 using the field lang* for the current customer, fetch all the record
 for the customer's language.

 Should I do this from customer_controller? Or is it a bad idea?
 Do I need to create the lang_controller?
 And how do I, from customer_controller, include the rows from the
 language table?
 Thanks.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: find a string in a file

2011-06-05 Thread AGoofin
Should be able to do something like to separate the tasks:

u = open( myfile )
  while line = u.gets
if line.include?( taske : )
  anArray = line.split(' ')
  puts anArray[1] if anArray.length  0
end
  end

You could even combine the split function with the index function
line,split(' ')[1] if you are sure where the target info will be.

Note: Don't be afraid to try different things. This solution is only
one of many and others here could do a lot better. You could do better
with a little practice and research.


On Jun 5, 7:08 pm, Adel Mediouni mediouni.a...@gmail.com wrote:
 hi
 i want to find a string in file then retrieve the rest,this is an
 exemple of a line:
 taske :say_hellow do
 i want retrieve just say_hellow
 so how can i do please.
 thanks.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: My web developer has abandoned me with a Rails site. NEED HELP ASAP

2011-05-10 Thread Agoofin
Take a look at some of the tutorials around the internet for Ruby and
Rails to get an idea of what the framework is first.

You say the app has been started, if you have a local copy of the
files - back them up and then browse the code.

I agree with the other posters as to wanting more information.

On May 8, 4:51 pm, grouppicture p...@grouppicture.com wrote:
 Im looking for immediate help. My web developer had started building
 me a site in Rails and has since gone AWOL and now I need to change
 info on the site but I have ZERO experience with code of any type. I'm
 looking for a hero who can help walk me through editing some copy that
 needs to be done ASAP.

 thank you in advance.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Is a way to output 'puts' or 'print'

2011-01-18 Thread Agoofin
You could log the output you wish to display. I think this would be
the best way if using a remote site.

But, if it's a local process and of limited use printing to the
console is ok. I wrote a rails program to track my local IP address as
it would change at random intervals and have the process print the
current IP out to a terminal.


On Jan 18, 7:23 pm, David Kahn d...@structuralartistry.com wrote:
 I have a long running process for an internal Rails 3 app. In a certain case
 I iterate over and process thousands + records which takes awhile. I want to
 output something like the detail of which record is being processed out to
 the user, to show that the process is in progress and not hung. This app is
 not about not keeping the user from waiting but to keep them in the loop,
 excuse the pun.

 So for example I have an array.each method which is handling these many
 records. Anyone have an idea how I could send messages out of this loop
 while it is in progress? If I was just writing a console app I would use
 'puts' or 'print'... so that I would see these messages in real time on the
 console. Any way to do anything similar on the web? I know on the ui side I
 would have to do some ajax in a loop to get the updates. Thinking aloud, I
 could have this method output to a db table which the ajax could query...
 kind of yucky.

 Just curious if there would be any easy way to do this before I resort to a
 simple spinner.

 Thanks,

 David

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: editors available for designing for ror..

2010-11-28 Thread Agoofin
I've used NetBeans on Linux and Windows and was happy with it.

Aptana is very good for RoR dev with GIT integration

On the horizon is Redcar an IDE written in Ruby that lists TextMate as
a major inspiration.

On Nov 26, 5:58 am, Emanuel venkatareddy...@gmail.com wrote:
 can anybody tell me wat are the editors available for developing web
 pages(/static pages) for the rails application

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: to change ruby187 code on rails 235 to ruby192 on rails3

2010-10-13 Thread Agoofin
You may want to consider rebuilding your app under Rails 3 as there is
quite a bit of difference. I upgraded a project from Rails 2.3 to 3.0
and it was difficult.

There are several guides out there though for upgrading.

On Oct 11, 10:51 am, Marnen Laibow-Koser li...@ruby-forum.com wrote:
 Premanshu Mishra wrote:

  Hi Railsers,

  I want to transport my codes written using ruby 1.8.7 on rails 2.3.5 to
  ruby 1.9.2 on rails 3.0.0

  Any help would do wonders...

 Hmm.  Here's the way I'll probably do it when I upgrade my projects:

 1. Install RVM.
 2. Install Ruby 1.9.2 and Rails 3 under RVM, so I can flip back and
 forth between the two versions of the project.
 3. Run with Ruby 1.9.2/Rails 3 and see which tests fail.
 4. Pick one failing test and make it pass.
 5. Refactor as necessary.
 6. Repeat steps 4 and 5 till done.
 7. Tidy up anything else that needs it.



  Regards,
  Premanshu

 Best,
 --
 Marnen Laibow-Koserhttp://www.marnen.org
 mar...@marnen.org
 --
 Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Implementing a News Feed / Activity Feed on Several Models - Recommendations?

2010-09-28 Thread Agoofin
Nice solution!

Another possibility would be to use the before_create and delete
methods.

Or just have the new controller pull the latest info from your other
models by looking at the updated_at field. This way you wouldn't have
to have an extra step when deleting items.

On Sep 28, 11:03 am, hornairs harry.brund...@gmail.com wrote:
 I did it by creating a new model called FeedItem and then creating an
 observer to watch a certain subset of models and create feed items
 when they were created, updated, and deleted. FeedItems have a
 polymorphic association to the model being talked about and a user
 association for who is doing the action, and then a string field
 denoting the action taken on them (created or destroyed for
 example).

  Then on each model I created a #best_identifier method which allows
 the model to specify how it should be identified to the user in the
 feed and elsewhere in the app. So for the feed itself, I just render
 the last 30 feed items with #{feed_item.user_id}
 #{feed_item.action_name} #{feed_item.modified_model.best_identifier}
 on #{feed_item.created_at.to_s(:short)}.

 Hopefully this helps! I can pastie my exact code if you'd like. There
 are some other small tidbits to add like checking for destroyed models
 (because you can't call best identifer on them anymore), linking to
 the model and perhaps user, adding images where appropriate, ...

 On Sep 27, 11:14 pm, nobosh bhellm...@gmail.com wrote:







  Hello, I'm interested in learning how to implement a News Feed /
  Activity Feed on a web app for multiple models like Books, Authors,
  Comments, etc...

  Any recommendations from the group? Gems/Plugins, or experience
  personally or from others on the best/smartest way to proceed?

  Thanks!

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: I cant' use Netbenas to develop ruby

2010-09-23 Thread Agoofin
I stay on the command line for the generators and such, using Netbeans
to do the other programming tasks.



On Sep 23, 4:00 am, Vitaliy Yanchuk m...@vitalik.com.ua wrote:
 Try to set config.action_controller.consider_all_requests_local = true for 
 your development environment
 It will show proper Exeption message instead of We're sorry, but something 
 went wrong.
 On 23 сент. 2010, at 10:44, Tanawat Limungkura wrote:







  I try to develop ruby with netbeans and mysql.I try to generate
  controller XXX and views YYY and I try access my tested web.But it shows
  me
                 We're sorry, but something went wrong.
  We've been notified about this issue and we'll take a look at it shortly

                   What's wrong. I used WEbrick as server

                                                       Thanks
  --
  Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
  To unsubscribe from this group, send email to 
  rubyonrails-talk+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: How to access a model method from within a view?

2010-09-19 Thread Agoofin
If this is only in the show method - one record, I assume, why not
pass the height and width as instance variables in the method call
which are then available in the view?

On Sep 19, 10:11 am, Abder-Rahman Ali li...@ruby-forum.com wrote:
 radhames brito wrote:
  show the code where you are trying to access, ill see whats wrong with
  it

 Thanks @radhames.

 The main issue is how to make a call to the height() and width() methods
 in the model in this line in show.html.erb:

 canvas id=draw height = ? width= ?
 /canvas

 This is my modeldicom.rb:

 class Dicom  ActiveRecord::Base
   has_attached_file :photo, :styles = {
   :original = [100%, :jpg],
   }

   def height()
   uploaded_file = photo.queued_for_write[:original]
   dimensions = Paperclip::Geometry.from_file(uploaded_file)
   return dimensions.height
 end

   def width()
   uploaded_file = photo.queued_for_write[:original]
   dimensions = Paperclip::Geometry.from_file(uploaded_file)
   return dimensions.width
   end
 end

 And, this is my show.html.erb:

 %= javascript_include_tag coordinate %
 canvas id=draw height =  width= 
 /canvas
 p id=notice%= notice %/p
 p
 b Name /b
 %= @dicom.name %
 /p
 p
 b Image /b
 /p
 div id=image_element style=display: none;
 p
 %= image_tag @dicom.photo.url , :id = 'dicom_image' %
 /p
 /div
 %= update_page_tag do |page|
 page  drawImg();
 end
 %
 %= update_page_tag do |page|
 page  drawLine();
 end
 %
 %= link_to 'Edit', edit_dicom_path(@dicom) %
 %= link_to 'Back', dicoms_path %

 Thanks a lot.
 --
 Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Paperclip - helppppp

2010-09-13 Thread Agoofin
If you're getting the original image then you have ImageMagic setup
correctly.

On Windows there is a bug in the current paperclip gem where the
ImageMagick arguments are surrounded by single quotes, which windows
doesn't like.

Take a look at the console output to see the errors, try the commands
that paperclip log outputs. If you have the single quote problem then
update the paperclip.rb file:
def quote_command_options(*options)
  options.map do |option|
option.split(').map{|m| #{m} }.join(\\') #removed single
quotes around #{m}
  end

Also note that in current version of ImageMagic the size in the styles
hash no longer takes a final character, only the dimensions. So if you
have :medium ='300x300', it now has to be just '300x300'

Hope this helps

On Sep 13, 8:44 pm, daze dmonopol...@gmail.com wrote:
 I keep seeing this error when I try to upload an image:
 --
 2 errors prohibited this panel from being saved

 There were problems with the following fields:

 Image C:/Users/Family/AppData/Local/Temp/stream,10032,0.png is not
 recognized by the 'identify' command.
 Image C:/Users/Family/AppData/Local/Temp/stream,10032,0.png is not
 recognized by the 'identify' command.
 --

 If I have my model Panel (which needs an image attachment) look like
 this, with the 'whiny' option set to false...

 class Panel  ActiveRecord::Base
         belongs_to :section
         acts_as_list

         has_attached_file :image, :styles = { :medium = 300x300,:thumb
 = 100x100 }, :whiny = false

         validates_attachment_content_type :image, :content_type=['image/
 jpeg', 'image/jpg', 'image/png', 'image/gif'],
                 :message = 'can only be jpeg, jpg, png, or gif',
                 :unless = Proc.new { |photo| photo[:image].nil? }

 end

 then I can upload an image. BUT I find that the following doesn't
 work:

 %= image_tag panel.image.url(:medium) %
 %= image_tag panel.image.url(:thumb) %

 ...while the regular, %= image_tag panel.image.url % works fine.  I
 have a feeling that the reason these two don't work is somehow tied to
 my first problem, when :whiny was not set to false.  Maybe the first
 error might somehow be responsible for the directory not getting made
 for the :medium and :thumb...each images in the 'systems/images'
 directory only has 'original' - no 'thumb' or 'medium.'
 But I don't know!  All I know is that the directory for thumb and
 medium don't get made, so those 2 lines of code won't work!

 Please helppp...this has been very frustrating

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Unable to get RAILS 3 recognize the Ruby 1.9.2 on Ubuntu 10.04

2010-09-12 Thread Agoofin
You might install rvm as well. I've fund it to be very helpful being
able to have multiple - isolated - ruby and rails versions. One of the
best features is to have a per project gem setup.

I had problems with ruby on Kubuntu without rvm, now it is smooth
sailing

On Sep 12, 11:37 am, Brian Prior br...@kendog.freeserve.co.uk wrote:
   On 12/09/2010 16:16, Frederick Cheung wrote:

  On Sep 12, 2:57 pm, Srikanthsri...@gmail.com  wrote:

  I am not sure how to get RAILS recongnize the fact that I have Ruby
  1.9.2 installed.

  What does the shebang inside the rails executable look like ?

  Fred

 You should install Rails for this copy of Ruby i.e. gem install rails.
 Check your Ruby version first with ruby -v.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Couldn't find User without an ID

2010-09-12 Thread Agoofin
You might take a look at your routes for future reference.
Specifically, take a look at RESTful routing where rails does most of
the work for you. The home path you setup could easily be the index
path for your base controller.

On Sep 12, 4:05 pm, Anders_P and...@andersplanting.se wrote:
 Thanks radhames!

 I finally got it to work, it turned out that i didn't need to define
 @user in my home action, and it was causing the error. Sorry if my
 description was unclear. Thanks for your help!

 // Anders

 On 12 Sep, 20:41, radhames brito rbri...@gmail.com wrote:

  it the route you set a requirement but you could access the client with a
  query, something like this

  link_to http://user.name/Home, root_path(:id=@user.id)

  but what this does is add this to the url string

  ?id=1

  and is not what you want since people can still access  the original with
  out ?id=1 gicing user the same message
  so what you do is create a route like this

  match 'products/:id' = 'catalog#view'    copied from the
  routes.rb comments

  you see here the id is specified that means that it the user access product
  with no id the message will be

  no routes matched /products

  and that is what we want, not an error in the controller is just that there
  is no page in the site you can access without specifing
  the id.

  conclusion
  is not a good idea to have a root route that requieres an id instead

  match 'pages/:id'  = 'pages#home'

  and

  root :to = welcome#index

  On Sun, Sep 12, 2010 at 7:48 AM, Anders_P and...@andersplanting.se wrote:
   Hi radhames!

   So the problem lies in my routes!?!, do you have any suggestion on how
   it should look?

   Thanks!

   // Anders

   On 12 Sep, 04:48, radhames brito rbri...@gmail.com wrote:
ok there is a problem

@user = User.find(params[:id])      = params[:id] is
   pulled
from the url query string

in rails the convention is this

/controller/action/id

in cases there you need to pull one specific record

/controller/action

to pull a collection

@user = User.find(params[:id])

here you are pulling an specific user but

root :to = 'pages#home'

there is no id at the end of your  so params[:id] has nothing in it

thats why Couldn't find User without an ID

On Sat, Sep 11, 2010 at 2:08 PM, Anders_P and...@andersplanting.se
   wrote:
 Thanks for your tips Colin!

 Hi radhames!

 Thanks for your help on my previous topic.

 Here is my routes.rb file:

  resources :users
  resources :sessions, :only = [:new, :create, :destroy]
  resources :ads,      :only = [:new, :create, :destroy]

  match '/registrera',  :to = 'users#new'

  match '/inloggning',  :to = 'sessions#new'
  match '/utloggning',  :to = 'sessions#destroy'

  root :to = 'pages#home'
  match '/kontakt',   :to = 'pages#contact'
  match '/om',        :to = 'pages#about'

 Thanks!

 // Anders

 On 11 Sep, 19:21, radhames brito rbri...@gmail.com wrote:
  home action seems to be a member restful action and it needs an id 
  to
 find
  the record but you are not declaring that route the right way
  show the routes please

  On Sat, Sep 11, 2010 at 8:25 AM, Colin Law clan...@googlemail.com
 wrote:
   On 11 September 2010 12:14, Anders_P and...@andersplanting.se
   wrote:

   Could you not top post please, it is easier to follow the thread 
   if
   comments are inserted into the previous post.  Thanks

Hello Colin!

Thanks for your reply. You are right about where the error is
occurring, this line is causing the error, @user =
User.find(params[:id]).

I haven't passed the id to the home action, where should i do
   that
 and
how? Sorry for the noobish question but your help would be gold!

   That depends what you are trying to do.  If you explain that we 
   may
   be
   able to help.  If you do not know what the params hash is all 
   about
   then you need to work through some basic tutorials.  See the rails
   guides athttp://guides.rubyonrails.org/ifyouareusing Rails 3 or
  http://guides.rubyonrails.org/v2.3.8/ifusingversion2.3.x.  Start
   with Getting Started obviously, then work through the others.

   Colin

On 11 Sep, 12:43, Colin Law clan...@googlemail.com wrote:
On 11 September 2010 11:34, Anders_P and...@andersplanting.se
 wrote:

 Hello!
 I'm trying to create a list of user ads on my home page in
   my
 app.
 But I don't get it to work. I'm a rails noob so it might be
 something
 trivial.
 I'm currently running into this error:

  Couldn't find User without an ID

There should be a lot more information available with the 
error,
including where it has failed.  The clue may be in the error
   message
though, it is trying 

[Rails] Re: slow rails environment load for unit tests, etc on windows

2010-09-12 Thread Agoofin
Windows will always be slow with the stock rails app. Windows will
load the rails environment every time which takes about 20 secs on my
vista box.

I've recently looked into this after taking several minutes to debug
some tests. One of the possible solutions is to use to RSpec. I'm no
expert on it as I couldn't install it on ruby 1.8.7 (window - got to
love it). But supposedly RSpec has a server that loads the environment
only once.

On Sep 12, 3:14 pm, radhames brito rbri...@gmail.com wrote:
 are you sending mail in your app??

 On Sun, Sep 12, 2010 at 12:57 PM, E elliot.g...@gmail.com wrote:
  Here's the behavior I am getting now
  So, I add entries in gemfile and gemfile.lock
  I place a require 'faster_require' in the boot.rb file.

  run gem install
  then I can run rake test:units. The strange thing is that I can only
  do a rake test:units one time... or instead do a rails console one
  time
  the second time I try running a rails console (without any changes)
  the console or tests fail to load, barfing out a rather long error
  string.
  I do another gem install faster_require and can run console or
  test again... just one time.

  Ideas?

  --
  You received this message because you are subscribed to the Google Groups
  Ruby on Rails: Talk group.
  To post to this group, send email to rubyonrails-t...@googlegroups.com.
  To unsubscribe from this group, send email to
  rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Cumulative Sum with will_paginate and activerecord

2010-09-11 Thread Agoofin
Or include a separate variable with the sum you want to include in
addition to the will_paginate variable.

@figures = Figures.paginate...
@figure_sum = Figures.sum(...

On Sep 11, 1:13 pm, radhames brito rbri...@gmail.com wrote:
 add a hidden field with    []  in them it will make the params create an
 array and put the ids of the paged record in them , then
 pass the array in a find and call sum on it.

 f.hidden :things, thing.id[]

 then

 find(params[:things])

 On Sat, Sep 11, 2010 at 5:45 AM, Fidel Viegas fidel.vie...@gmail.comwrote:

  On 9/11/10, Frederick Cheung frederick.che...@gmail.com wrote:

   On Sep 10, 7:50 pm, Fidel Viegas fidel.vie...@gmail.com wrote:
   On 9/10/10, radhames brito rbri...@gmail.com wrote:

AR has a sum function.

   Hi Radhames,

   I am aware of the sum function, but it does not do cumulative sum on
   its own. I know how to do it using recursive queries or stored
   procedures, but my question is how to deal with that using
   will_paginate.

   I will try to read the api and see if I can tweak it.

   The sum function takes conditions just like find does. Depending on
   what you are sorting on you should be able to construct the relevant
   conditions from the items will paginate fetches for you.

  For the problem in question that does not work. I read through the
  documentation and found out that I could paginate_by_sql, which is
  what I really needed.

  Thanks a lot

  Regards,

  Fidel.

  --
  You received this message because you are subscribed to the Google Groups
  Ruby on Rails: Talk group.
  To post to this group, send email to rubyonrails-t...@googlegroups.com.
  To unsubscribe from this group, send email to
  rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: nested routes question

2010-09-07 Thread Agoofin
What is the difference between persons and contests as far as scores
are concerned? Looks to be a polymorphic relationship based on the
context of your post. Person to Scores and Scores to Contest.

I agree with radhames, though in lower case. I've found that you need
only be concerned with one level of nesting at a time.

On Sep 7, 5:49 pm, radhames brito rbri...@gmail.com wrote:
 DONT DEEPLY NEST ROUTES DOONT

 On Tue, Sep 7, 2010 at 3:31 PM, Marnen Laibow-Koser 
 li...@ruby-forum.comwrote:







  Ed wrote:
   Trying to convert my app (and brain) to RESTful routes from the old
   style.  What is the accepted approach to nesting a resource within 2
   other resources?

  Well, REST only has to do with routing and external interface.  It tells
  you nothing about the implementation details of how to structure your
  controllers, which seems to be your real question here.

   Example:

   Models

     Person has_many :scores
     Contest has_many :scores
     Score belongs_to :person, :contest

   Routes

     resources :people do
       resources :scores
     end

     resources :competitions do
       resources :scores
     end

   I want to be able to list scores by person, or by competition.  Either
   of the these two paths will request the :index action in the :scores
   controller:

   GET /people/person_id/scores
   GET /contests/contest_id/scores

   So what is the best way to structure scores/index to deliver the
   appropriate list?

   I could test for the presence of params[person_id] or
   params[contest_id], then execute and render accordingly within
   the :index action.  But that seems somewhat inelegant.

  Does it?  If you want to reuse the same controller action, it seems
  entirely reasonable to test the data you're getting passed.

   Is there a
   better way?  Should I have two separate actions within the :score
   controller, and modify my route mapping somehow to request the
   appropriate action?

  You could do that, certainly.  I think I'd use the former solution,
  though.

  Best,
  --
  Marnen Laibow-Koser
 http://www.marnen.org
  mar...@marnen.org

  --
  Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
  To unsubscribe from this group, send email to
  rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Ruby on Rails IDE

2010-08-24 Thread Agoofin
Netbeans works well, if you're concerned about the bloat/response
simply turn some of the features off. I've used Rails for a few years
and a basic editor just seems so, well basic. Netbeans isn't perfect,
I don't use it to run the server or do the tests but for the simple
pleasure of jumping between controller method to view just cannot be
beat.

If you're on Linux with KDE, Kate works well as a basic editor.

Windoze - try Notepad++, very lightweight and easy to use.

But in the end, it's your preference. Find something you're
comfortable with and go with it.

On Aug 23, 9:25 pm, ZRiddick tcr.t...@gmail.com wrote:
 Really strange that I cannot find a lot of discussion on a good RoR
 IDE. Most of what I have pulled up dates to 2008.  Also the Eclipse
 IDE has trouble finding the JRE running on Windows 7 64 bit. Very
 surprised that Eclipse is not more concerned with having there
 platform work better with JRE since it is so dependent upon it. I
 dropped it like a hot potato for this reason. I am going to give the
 netbeans a go but I would like a lot more input on the matter from
 seasoned RoR developers. If I am missing something please let me know.
 I am really interested in switching to Ruby for developing enterprise
 apps. Otherwise I will be forced to go with visual studio wfc.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: How to development Database for testing

2010-08-17 Thread Agoofin
Take a look at some Rails testing resources - 
http://guides.rubyonrails.org/testing.html
- take a look at  the fixtures part.

I can't think of a reason not to have a separate testing database or
to try and run tests on the dev db, unless you are trying to re-invent
the wheel and make your own test suite. I think quite a few of us have
had the experience of trying to build something, like unit tests, that
have in place several standard solutions already.



On Aug 17, 9:51 am, Ar Chron li...@ruby-forum.com wrote:
 Rajkumar Surabhi wrote:
  Marnen Laibow-Koser wrote:

  hi,
  May be but i need it to use single development database for both
  enviroments

 Rails makes the right things to do very easy, and if you stray outside
 that, well you made a conscious decision to go that route, and bear the
 consequences.

 You *are* using automated testing aren't you?

 You *are* keeping your tests up to date with the code and data changes
 you make in your development database on an ongoing basis?

 You really need to look into some automated testing tools available for
 Rails to do this with any kind of replicability and efficiency.

 If you absolutely, positively, against-all-reason-and-recommendation
 have to use the same database for dev and test, I would still not do
 exactly that.

 I'd suggest you use sqlite for your development database, and copy your
 development.sqlite3 file to test.sqlite3 before running your tests, each
 and every time.

 --
 Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Paperclip Trouble - Not Writing to the Database

2010-08-09 Thread Agoofin
I didn't see the avatar_file_size, avatar_content_type, and
avatar_created_at fields in your form. I don't know if these are
required though as they should be created when you submit a
file_field.

You can store the images in the database if you want to, but most
would recommend you don't.

Have you looked in the location to see if an image was being saved?

Have you asked on the paperclip Google group?


On Aug 8, 7:17 pm, A. Leek li...@ruby-forum.com wrote:
 Bb Serviss wrote:
  I noticed in your form that you didnt specify any of the support
  fields that paperclip uses -avatar_file_name for example - if these
  aren't in the params hash they won't be saved in the db. In a recent
  project I added all the fields to the form, but you could add them as
  hidden.

  Paperclip doesn't store the image in the database so is an actual
  image being stored in the location you setup?

 I'm not sure what you mean by support fields...I looked around, but
 couldn't find much clarification.

 I know that Paperclip doesn't store the actual image in the database,
 that would be silly :) But it's not saving anything to the database in
 the avatar_file_name, _content_type, _file_size, or _updated_at fields,
 they're just NULL.

 Anyway, I followed Fernando Perez's advice about attr_accessible and it
 sort of worked, now I'm getting a different error: Avatar
 C:/DOCUME~1/mars/LOCALS~1/Temp/stream,5388,3.jpg is not recognized by
 the 'identify' command.

 I poked around and it seemed to be a problem with ImageMagick, which I
 didn't have installed. I installed it and checked that the PATH was
 right, but it keeps giving the the same error. Looking around, I tried
 the solution 
 here:http://snipplr.com/view/29445/getting-paperclip-working-in-windows/
 changing the ImageMagick location to what I had in the PATH, but it
 keeps giving me the same error.
 --
 Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: What Advice Would You Give A Rails Newbie?

2010-08-09 Thread Agoofin
I found a couple of good books, Simply Rails 2 by Lenz is my favorite.
Of course it's for Rails 2. You may have to wait for a while for the
new crop of Rails 3 books to come out. Or try to update the examples
to work in Rails 3.

Judging by your questions about template engines and user management,
I'd recommend a more advanced book like The Rails Way.

Other than that, try to build your own app. Nothing really works
better than that.



On Aug 7, 2:54 pm, Brad Lindsay brad.lind...@gmail.com wrote:
 I'm new to Ruby and to Rails, but have been very impressed by the
 tutorials I've gone through for each.  They have convinced me that
 these are the best tools for the solutions I need to create, but
 before I really got started, I thought I'd query the wisdom of this
 list.

 Note, I plan on starting with Ruby 1.9 and Rails 3.0.

 Is there a better template engine than the default ERB? What do people 
 suggest?

 Is there an overview of best-practices when it comes to User
 management and account authorization and authentication? Is there a
 gem that I should look at that may implement some of this?

 Are there other issues or best-practices that I should know about or
 gems that you would suggest I investigate?

 Thanks,
 Brad

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Is there anything else I can use besides rails?

2010-08-08 Thread Agoofin
On the off chance you meant using Rails elsewhere - I have used
ActiveRecord outside Rails for some database programming.

On Aug 7, 4:33 pm, Tony Mr li...@ruby-forum.com wrote:
 Can ruby be on anything else besides rails?
 --
 Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Paperclip Trouble - Not Writing to the Database

2010-08-08 Thread Agoofin
I noticed in your form that you didnt specify any of the support
fields that paperclip uses -avatar_file_name for example - if these
aren't in the params hash they won't be saved in the db. In a recent
project I added all the fields to the form, but you could add them as
hidden.

Paperclip doesn't store the image in the database so is an actual
image being stored in the location you setup?


On Aug 7, 11:16 am, Fernando Perez li...@ruby-forum.com wrote:
 A. Leek wrote:
  But it's still not fixing the SQL query.

 Then I'd guess you have attr_accessible? I have fallen into that trap in
 the past too ;-)
 --
 Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Development Environment (Beginners Question)?

2010-08-02 Thread Agoofin
I use Windows Vista for a lot of my RoR development as it's convenient
for me with my current setup even though I run an Ubuntu box as well.

Not everything works in windows, as you might expect, but 95% of it
does. This is with a regular ruby install, no instant rails- which is
out of date.

You will learn quite a bit using windows. Some of the stuff you learn
- how to trouble shoot malfunctioning gems for example - will be
invaluable to you later on.

If you have some major computer horsepower you can go the virtual
route, but it might be better to dual boot linux.

My advice is to try installing ruby and rails in win 7 first. Take
notes and blog about it.

On Aug 1, 6:29 am, Michael Pavling pavl...@gmail.com wrote:
 On 1 August 2010 06:16, ncage choclab...@gmail.com wrote:

  is a windows machine good enough to get started with ROR Development?

 Honestly, without trying to be contentious: no.

 You *can* get along getting into Rails using Windows (I started that
 way with InstantRails), but you will discover occasional things that
 don't work *quite* how you expect, especially when you get to using
 lots of third-party plugins/gems. You will probably be better off,
 going straight into a *nix environment of some description.

 The easiest solution is to use a VM (either install your own, or use
 the out-of-the-box VirtualRails [1] for an all-in-one solution, or the
 TurnkeyLinux Rails Server [2], either of which you can then customise
 to your heart's content).

 But if you want to make the leap to Ubuntu as a desktop OS it does cut
 out the hypervising midle-man :-)

 [1]http://www.virtualrails.org/
 [2]http://www.turnkeylinux.org/rails

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Trying to pick a model setup without ridiculous routes

2010-07-24 Thread Agoofin
Finally - a subject near and dear to my heart - beer!

One thing to remember about nested resources is its best to nest one
level at a time. Otherwise you get very complicated url's.

Depending on how you set the relations, you could have beer as a
nested resource of brewery and then set a separate nested resource
relationship between beer and style.

  map.resources :beers

  map.resources :breweries

  map.resources :styles

  map.resources :breweries, :has_many = [ :beers ]

  map.resources :beers, :has_many = [ :styles ]

So when you are dealing with breweries, you are only dealing with
beers. The same thing happens when you are working with beers, except
now you have the styles sub-resource.

Looking at this problem though it seems like a better solution would
be a has_and_belongs_to_many relationship between beers,breweries, and
styles. A brewery can make several different beers each of a different
style after all. To do this you would create a join table that only
includes key fields (beers_id, breweries_id, styles_id).

I found a tutorial that should point you in the right direction:
http://www.buildingwebapps.com/podcasts/79342-resources-page-links-categories-and-habtm/24793-show-notes


On Jul 23, 7:42 pm, Joel Klabo joelkl...@gmail.com wrote:
 I am making a site with beer info. I want to have the beer name,
 brewery and style info for every beer. So they all need to be
 connected. But, I don't want two styles, i.e. Pale Ale, pale ale,
 paleale. So I was thinking of making style it's own model and people
 could choose from a list, and then add one if it wasn't present
 there.

 But, if I had separate models for brewery also the URLs would be
 nested like crazy. And, I want to be able to look up all the beers of
 a certain style or from a certain brewery from the URL: example.com/
 style/1, or example.com/brewery/1, as well as brew/1.

 I know this is an involved question but I just can't wrap my mind
 around it. I would appreciate any advice. Thanks for reading.

 SHORT VERSION:

 I want 3 models connected, but I don't want the nested URL craziness.
 How?

 Joel

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails equivalent of Delphi SetRange()

2010-07-12 Thread Agoofin
I use Delphi (Lazarus) at work and I constantly miss ruby features :)

I can only echo Marnen's remarks about Rails, Delphi does some weird
things and I've found that doing it the Rails way is usually simpler
and much more efficient.

As far as the bookings, you should do a bottom up review by starting
off with what would be the perfect view for you. Something by venue
that not only shows the two teams but their win/loss percentage and
amount of late/early games which would aid in scheduling. Make
something that makes sense to you.

Clashes though - shouldn't that be the player's responsibility?

Also, don't forget unit tests and a revision control system (like git)
as both of these will help you in many ways.

On Jul 12, 12:12 pm, Mark Horrocks li...@ruby-forum.com wrote:
 Marnen Laibow-Koser wrote:
  Hmm.  You *could* do a line-by-line port, then refactor to a more Railsy
  architecture -- but it will be a herculean refactoring.  Rewriting to
  the new architecture from scratch will probably be easier.

 I will do it from scratch. The algorithms for game draws and court
 bookings are quite complex.

 In the case of the game draw, there may be previous games played and the
 draw is a redraw for part of the season due to the addition or
 removal/transfer of teams. I need to ensure that the teams (up to 16
 teams) have not played each other for the longest time. Its a matter of
 testing each future week in the draw template to find the best week to
 start.

 In the case of court game time bookings, I need to ensure that neither
 team has been booked at the time and court combo being tested for the
 longest time. The teams will complain that another team has had x early
 games while they have had x late games. Further, the system must support
 clash teams where a team playing volleyball will not want to booked at
 the same time as a team playing basketball if some players play in both
 teams. Teams may also have times when they can't turn up to play.

 My customers are commercial social sports centers with potentially fluid
 competitions as teams may come and go during a season or there may be
 team regrades after several weeks if a team is either much better or
 worse than the other teams in its league. As you can see the temptation
 to port to what works already is very compelling but it seems the best
 way forward is to refactor from scratch. Pity RoR wasn't around in 2001
 when I originally wrote it. The website is sportdata.com.au

 --
 Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails equivalent of Delphi SetRange()

2010-07-11 Thread Agoofin
There are a few ways to do this.

One would be using a named_scope in Rails 2 or just plain scope in
Rails 3

class Bookings  ActiveRecord::Base
  named_scope :discount, :conditions = { :discount  .5 }

I like to model class methods for pulling specific information from
the database

  def self.inactive
find( :all, :conditions = [inactive = ?, 1], :order
= :last_calibrated_on )
  end
And then in the controller:

@inactive = Item,inactive

In Rails 3 there is a new query interface (
http://m.onkey.org/2010/1/22/active-record-query-interface )

The neat thing here is that it seems to map well to what you're doing.
You start off creating a relation that you can then manipulate, but
the query doesn't fire until you want it too.

Getting those datasets or updating the limits could be done through
javascript on the view page, periodically_call_remote or an observer
on a field.

On Jul 11, 2:34 am, Mark Horrocks li...@ruby-forum.com wrote:
 I am currently converting a large Delphi webbroker application to RoR.
 The Delphi application makes extensive use of client datasets and
 setrange which can limit the range of records returned to a client
 dataset in an SQL call without the overhead of making another SQL call.
 The setrange call can be issued in a loop to repeatedly change the range
 of records viewable in the dataset.

 My app frequently issues the setrange command to a dataset in a loop in
 order to test for previous game time bookings in a sports application.
 Is there any way I can do this in Rails or do I need to repeatedly make
 SQL queries to return the data subset?
 --
 Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Scaffold with no data ?

2010-07-11 Thread Agoofin
Did you rake db:migrate?

On Jul 11, 7:31 am, DrSney drs...@gmail.com wrote:
 Hello, please help me with one little error that I have here. I have
 created database structure, than generated scaffold for it (script/
 generate scaffold Artist). But when I try to use it, all i have is
 this (db contains t records):
 -
 Listing artists
 Show    Edit    Destroy
 Show    Edit    Destroy
 Show    Edit    Destroy

 New artist
 -
 The same with New artist - it just shows the submit button but no
 input forms. What is wrong ? Why doesnt it show data ?
 Thanx for reply in advance.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails equivalent of Delphi SetRange()

2010-07-11 Thread Agoofin


  And then in the controller:

  @inactive = Item.inactive

 This looks like it will still fire off a query which is what I want to
 avoid.

The query would only fire (once) prior to rendering the view. For
example, if you set the variable in the index action of the controller
the query would only be run after calling the index action.

 cars = Car.scoped
 rich_ppls_cars = cars.order('cars.price DESC').limit(10)

 It appears that the call to cars fires the query but the call to
 rich_ppls_cars only works on the resultant dataset and does not fire a
 new query. Would that be correct? For example, I could then say
 poor_ppls_cars = cars.order('cars.price ASC').limit(10) and I would get
 different data without a new query?

In Rails 3 the cars example above, you are creating a relation. The
query is fired when you call rich_people_cars.first or .all


Looking at some of the other posts here I agree there could be some
misunderstanding of what you're trying to do.

If it's 16 teams * 16 games that's only 256 results. You can query all
the records and then logically view the remainder in instance
variables.

Also, if you're looking at the bookings for holes then perhaps you set
the query to return records based on the date and venue. There are
only so many dates and venues available after all.

Interesting problem though and a good way to learn Rails.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Gentoo for Rails?

2010-07-08 Thread Agoofin
I had a much easier time installing rails on gentoo then ubuntu.

Of course on gentoo you have a lot more control over what's installed
with the price of knowing what to install.

Any distro will do though. I'd suggest looking into rvm as well.

On Jul 7, 2:58 pm, Sal fuente...@gmail.com wrote:
 I'm curious to know why Gentoo is a very commonly used distro for the
 Rails community. Any reasons for this?

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Is this book dated?

2010-07-07 Thread Agoofin
Every book is likely to contain some errors, most will have forums
where you can ask questions of the subject material as well.

Netbeans has everything I need. The side panes which show the project
structure and page elements which make not only navigating, but
understanding, the project easier. The code completion rocks and
really helps when editing html templates and css files as I try and do
as little html as possible.

On Jul 6, 8:16 pm, Marnen Laibow-Koser li...@ruby-forum.com wrote:
 Bb Serviss wrote:
  I really liked Simply Rails 2 by Patrick Lenz. It's the only rails
  book where I went through all the code examples.

 I haven't read that book, but based on all the technical errors in
 another one of Patrick's Rails books (Building Your Own RoR Web
 Applications), I'd tend to steer well clear of any of his Rails writing.



  As far as an IDE goes - I like Netbeans. You can code with a simple
  editor but nothing beats the view Netbeans gives you.

 NetBeans is a great IDE, but I do not believe it offers any advantage at
 all for Rails development (I use it for other stuff).  What do you mean
 by the view NetBeans gives you?

 Best,
 -- 
 Marnen Laibow-Koserhttp://www.marnen.org
 mar...@marnen.org

 Sent from my iPhone
 --
 Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Is this book dated?

2010-07-06 Thread Agoofin
I really liked Simply Rails 2 by Patrick Lenz. It's the only rails
book where I went through all the code examples.

As far as an IDE goes - I like Netbeans. You can code with a simple
editor but nothing beats the view Netbeans gives you.



On Jul 6, 4:11 pm, Marnen Laibow-Koser li...@ruby-forum.com wrote:
 Angel Marquez wrote:

 [...]

  Would you all recommend aptana radRails?

 No.  Rails doesn't benefit from the use of an IDE.  Just use a good text
 editor.



  I'm using vim  gEdit..they seem fitting.

 Yeah, that may be better.  Personally, I'm fond of KomodoEdit.



  Thoughts please.

  Thank you.

 standard-newbie-questions
 You are using test-first development and version control, right?
 /standard-newbie-questions

 Best,
 --
 Marnen Laibow-Koserhttp://www.marnen.org
 mar...@marnen.org
 --
 Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Good Linux Distro for Rails 3?

2010-07-03 Thread Agoofin
Ubuntu works well, but I would use rvm with rails - very good
experience with me using it/

On Jul 1, 4:36 pm, Nick Hird nrh...@gmail.com wrote:
 This may be the wrong place for this question but i am not sure where to go.

 What is a good linux distro to get started with rails 3? I have given up on
 ubuntu and any related distro since the version of gem isnt high enough for
 rails and its related packages. I cant seem to use Arch since they use ruby
 1.9.1. Is there a distro that has what i need in its package manager so that
 i can be up and running fairly quickly? I am not the best at getting all the
 packages running from scratch, so i rely on package managers but that seems
 to be a loosing battle as well. Any help or recommendations would be
 appreciated.

 ~Nick

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: rake db:create failing

2010-06-29 Thread Agoofin
I've had an issue with the sqlite driver. What version are you using?
Looking at the RubyForge site, they've released version 1.3.0 of
sqlite3-ruby on June 6th - upgrading this might help

On Jun 28, 3:49 pm, Joe x.lt0...@gmail.com wrote:
 Hi everyone,

 First of all, I'm running Mac OS X Snow Leopard.

 Trying to set up a new SQLite database, but when I run rake db:create,
 I get the following huge message:

 unable to open database file
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
 sqlite3_adapter.rb:13:in `initialize'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
 sqlite3_adapter.rb:13:in `new'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
 sqlite3_adapter.rb:13:in `sqlite3_connection'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
 abstract/connection_pool.rb:223:in `send'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
 abstract/connection_pool.rb:223:in `new_connection'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
 abstract/connection_pool.rb:245:in `checkout_new_connection'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
 abstract/connection_pool.rb:188:in `checkout'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
 abstract/connection_pool.rb:184:in `loop'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
 abstract/connection_pool.rb:184:in `checkout'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 1.8/monitor.rb:242:in `synchronize'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
 abstract/connection_pool.rb:183:in `checkout'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
 abstract/connection_pool.rb:98:in `connection'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
 abstract/connection_pool.rb:326:in `retrieve_connection'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
 abstract/connection_specification.rb:123:in `retrieve_connection'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/
 abstract/connection_specification.rb:115:in `connection'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/rails-2.3.5/lib/tasks/databases.rake:43:in
 `create_database'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/rails-2.3.5/lib/tasks/databases.rake:31
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in `invoke_with_call_chain'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 1.8/monitor.rb:242:in `synchronize'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in `invoke_task'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each'
 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
 

[Rails] Re: Silly little link_to question

2010-06-22 Thread Agoofin
What do you have in your by_company method?

looks like you had in your find statement - params[:id] and it should
have been params[:company_id]

You might take a look at generating a class method in your model file:

def self.by_company( anId )
   find(:all, :conditions = [company_id = ?, anId] )
end

The you can refer to this by Model_name.by_company( x )

Or a named scope - some things to look at.

Hope this helps

On Jun 22, 3:01 pm, richardsugg richards...@gmail.com wrote:
 Well, I got around it, but I'd like to know why the original way
 didn't work because I'm certain this will come up again.  Here's what
 I did:

 I changed the link_to to be

 %= link_to people,    :controller = people,  :action =
 by_company,      :id = @company.id %

 which created the link

 http://my-server-name/people/by_company/1

 Thanks for looking at this.  I'm sure this is a very easy question for
 someone who has done this a while, but that would not (yet) be me :)

 On Jun 22, 2:55 pm, richardsugg richards...@gmail.com wrote:

  Routes file:

  ActionController::Routing::Routes.draw do |map|
    map.resources :people
    map.resources :users
    map.root        :controller = homepage
    map.connect ':controller/:action/:id'
    map.connect ':controller/:action/:id.:format'
  end'

  On Jun 22, 2:51 pm, Rui Carvalho rui.hmcarva...@gmail.com wrote:

   How do you have this on your routes file?

   On Tue, Jun 22, 2010 at 7:34 PM, richardsugg richards...@gmail.com 
   wrote:
I want to show a page that lists people that belong to a particular
company (each person has a company_id).  My link_to looks like

%= link_to people,    :controller = people,  :action =
by_company,      :company_id = @company.id %

which produces the link

   http://my-server-name/people/by_company?company_id=1

However, it errors with

Couldn't find Person with ID=by_company
{id=by_company,
 company_id=1}

Why would the id be set to by_company?  Shouldn't that be the
action?

Thanks!

--
You received this message because you are subscribed to the Google 
Groups
Ruby on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2Bunsubscrib
 e...@googlegroups.com
.
For more options, visit this group at
   http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Web server

2010-06-22 Thread Agoofin
The web server simply looks at the information you submit ( a page for
example) and routes it to the proper destination in rails. With me
it's frequently error pages though.

Rails comes with a web server named webrick which works nicely enough
for learning about Rails. Mongrel is a separate, higher performance
web server that you can install via gem.

Keep plugging away at it with sample apps untill you feel confident
enough to write something of your own.

And - don't stop asking questions

On Jun 22, 12:28 pm, Abder-rahman Ali li...@ruby-forum.com wrote:
 Just have a small question especially I'm new to RoR and web
 programming. When we say that the application runs on a web server. Does
 that mean for example when I run my application at:http://localhost:3000, the 
 web server is my local machine?

 And, since a server is a bundle of HW + SW, what is the SW part of the
 server?

 Is it only Mongrel?

 Can you kindly explain what exactly is a web server?

 Thanks.
 --
 Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Model Namespace?

2010-06-22 Thread Agoofin
You could add a status field to your higher level models - for
example, add 'status' to User as an integer and then store your
status:descriptions in a common status table. So you store an integer
referring to the status in your User model and if you need to display
the description, query the status table with the id.

Or you could create the status tables and setup the relation between
them - both sides - the User would have_one = :user_status and the
belongs_to in the user_status model file.

I don't know if I would put the status views below Users or Projects
though. Depending on how many controllers you have - if it's a lot
then try to put the status under the User or Project views. It's more
than likely they should be beside the other controllers as you will
probably be adding some functionality to the status controllers such
as notifying someone if a project is in X status for some amount of
time. Also I would think the status controllers would be easier to
reuse if kept higher in the hierarchy.

In any case, you can put links to change the status anywhere you like.
Simply Rails 2 contains some very good examples of this using
javascript. You might want to check it out.



On Jun 22, 10:11 am, Fernando Brito em...@fernandobrito.com wrote:
 Hello,

 Sorry if this looks silly, but I trying to learn Ruby on Rails best
 practices.

 I have a model called Users and a model called Projects. Now I need to
 implement a status field to each one of them.  Each User/Project
 belongs_to a status.
 But because they have different kind of status possibilities, I will need 2
 new models: UserStatus and ProjectStatus.

 Something like:

 *- User*
 -- name
 -- gender, ...
 -- status_id (this must refers to UserStatus)

 *- UserStatus*
 -- name (like active, fired, etc)

 *- Project*
 -- name, ..
 -- status_id (this must refers to ProjectStatus)

 *- ProjectStatus*
 -- name (opened, completed, pending, etc)

 Also, to keep my application cleaner, I would like to have the ProjectStatus
 viewers inside my Project viewer folder.
 Something like:
 /app/views/projects/new.html.erb
 /app/views/projects/status/new.html.erb

 Is there any convention of doing this? Is that the correct way of doing what
 I want? What should I search for? Can namespaces help me? Am I picking
 good model names?

 Thanks,
 --
 Fernando Brito

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Deploy: Developing on Windows Deploying on Linux hosting

2010-06-22 Thread Agoofin
Ar is correct - Virtual Box http://www.virtualbox.org/ is one such
path and is free for personal use.

You might checkout Capistrano - http://www.capify.org/index.php/Tutorials

And depending on what you're deploying you might be interested in
Heroku - http://heroku.com/



On Jun 22, 8:46 am, Ar Chron li...@ruby-forum.com wrote:
 Ali Imran wrote:
  I am trying from a week to deploy my application. Please help me how
  to do this.

  Thanks

 To save yourself tons of potential future grief, try setting up a VM on
 your Windows machine that is based on the same Linux OS as your
 deployment target OS.

 Then it becomes easy-peasy, otherwise you're caught trying to make sure
 that the gems you have been using under Windows behave the same under
 your Linux OS.  Generally (very generally) not an issue.
 --
 Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Ajax/Prototype/Scriptaculous

2010-06-22 Thread Agoofin
Perhaps you can add a link_to_remote, either in the section or
surrounding it, to add an extra option then update the select list.

The Rails Cookbook has a section on using ajax to add DOM Elements to
a page

And there is this :http://api.rubyonrails.org/classes/ActionView/
Helpers/PrototypeHelper/JavaScriptGenerator/GeneratorMethods.html

On Jun 22, 5:35 am, Ants Pants antsmailingl...@gmail.com wrote:
 Hello,

 I can't find a way to do what I'm trying so maybe someone can throw
 something at me.

 The idea is if an option is not in a select list, the user can click a link
 next to the list 'not there?' and this will open uop a text field box below.
 The user then enters the missing option, hits enter and the select list will
 update and have the new entry already selected.

 I can use remote_form_tag to get to send the text_field without refreshing
 the page but I can't find an option as with text_field_with_auto_complete's
 :after_update_element. I want to fire another Ajax request to repopulate the
 select list.

 I may already have seen the solution in my searching but I now can't see the
 wood for the trees.

 CIA

 -ants

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Controllers, what? why?

2010-06-21 Thread Agoofin
I'm writing an application to track calibrated assets. If I were to
have one controller it would have to be able to update(delete, create,
read) the items,vendors, issues...etc. It would be huge and certainly
unwieldy, not to mention very difficult to do in the Rails framework.

The Items controller deals with the items table. All the views to the
data happens through this controller which makes the code easy to read
and understand.

I think the issue here is about how to plan and build your
application. The controllers are the building blocks for the app and
so serve as the first layer of design that you are using to solve the
problem.

Hope this helps


On Jun 21, 7:04 am, Paulo J. Matos pocma...@gmail.com wrote:
 Hi,

 I am starting to learn rails and I went through the guide and a couple
 of tutorials. Even though I understand controllers or at least I can
 use them I can't see yet the whole picture.

 Why do you need several controllers for a single application? If a
 controller is just a class whose methods interface with models and
 views, why not have a single controller for the whole application?
 Can someone please comment on this maybe with an example on an obvious
 situation where having two controller makes more sense than having
 just one?

 Thanks,

 --
 PMatos

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: gitignore

2010-06-20 Thread Agoofin
I like the IDE approach overall. Netbeans has some nice autocomplete
features that really help in writing the code, but then again a simple
editor can work well too.

For the gitignore, just add a pattern of which files you don't want
included either in the root directory or in the specific directory.
Something along the lines of tmp_*

Should be a setting in rad rails for the backups as well.

Hope this helps.

p.s. http://help.github.com/git-ignore/

On Jun 20, 1:44 am, giorgio george.pever...@gmail.com wrote:
 I have just started using rad rails again after a long stint on
 netbeans.

 It seems to generate loads of files like:
 app/views/group/.tmp_group_summary.rhtml.99932

 I want to make git ignore all these .tmp files but my entries in
 gitignore have so far been of no avail.

 Anybody give me a suggestion?

 Cheers
 George

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Problem with testing rails applications..

2010-06-20 Thread Agoofin
Seems others are having this issue on Windows as well.

Try here for some direction: 
http://groups.google.com/group/rubyinstaller/browse_thread/thread/bd7ec8e1dab4ff17

Hope this helps

On Jun 20, 2:11 pm, Joe j...@dev-hq.co.uk wrote:
 When trying gem install sqlite3-ruby; it spits out no definition
 for libversion.

 And when trying to rake gems:install it seems to think that
 everything is absolutely fine.

 Please note although I dont think it'll make a difference I get this
 on starting the application:

 C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/gem_dependency.rb:
 99:Warning: Gem::Dependency#version_requirements is deprecated and
 will be removed on or after August 2010.  Use #requirement

 Please Help,

 Thanks In Advance,

 -Joe

 On Jun 20, 6:10 pm, Conrad Taylor conra...@gmail.com wrote:

  Sent from my iPhone

  On Jun 20, 2010, at 9:42 AM, Joe j...@dev-hq.co.uk wrote:

   Hi,

   Recently I've been trying to add permalinks to my rails system, so
   because I had my new OS just installed I installed ruby and rails and
   all of the things I had before..
   Then I downloaded my application files directly from the web, and
   attempted to run the server; when I visit it in my browser it comes up
   with my custom error message, and the console displays this:

   /!\ FAILSAFE /!\  Sun Jun 20 17:39:08 +0100 2010
    Status: 500 Internal Server Error
    no such file to load -- sqlite3

   From the message above, you are missing sqlite3.  You might want to
  verify that each gem dependency is installed before you try to run
  your application.

  Good luck,

  -Conrad

   C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
   `gem_original_require'
      C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
   `require'
      C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
   active_support/dependencies.rb:156:in `require'
      C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
   active_support/dependencies.rb:521:in `new_constants_in'
      C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
   active_support/dependencies.rb:156:in `require'
      C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
   active_support/core_ext/kernel/requires.rb:7:in
   `require_library_or_gem'
      C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
   active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
      C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
   active_support/core_ext/kernel/requires.rb:5:in
   `require_library_or_gem'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/connection_adapters/sqlite3_adapter.rb:10:in
   `sqlite3_connection'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/connection_adapters/abstract/connection_pool.rb:223:in
   `send'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/connection_adapters/abstract/connection_pool.rb:223:in
   `new_connection'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/connection_adapters/abstract/connection_pool.rb:245:in
   `checkout_new_connection'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/connection_adapters/abstract/connection_pool.rb:188:in
   `checkout'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/connection_adapters/abstract/connection_pool.rb:184:in
   `loop'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/connection_adapters/abstract/connection_pool.rb:184:in
   `checkout'
      C:/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/connection_adapters/abstract/connection_pool.rb:183:in
   `checkout'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/connection_adapters/abstract/connection_pool.rb:98:in
   `connection'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/connection_adapters/abstract/connection_pool.rb:326:in
   `retrieve_connection'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/connection_adapters/abstract/
   connection_specification.rb:
   123:in `retrieve_connection'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/connection_adapters/abstract/
   connection_specification.rb:
   115:in `connection'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/query_cache.rb:9:in `cache'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/query_cache.rb:28:in `call'
      C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
   active_record/connection_adapters/abstract/connection_pool.rb:361:in
   `call'
      C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
   action_controller/vendor/rack-1.0/rack/head.rb:9:in `call'
      C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/
   

[Rails] Re: Why do rails calls a method when I'm calling a property?

2010-06-20 Thread Agoofin
Look at your link_to in the index.html, it should contain the id for
the story you want to show.

Also, check to make sure that you have the to_param method in your
model, story.db and that it's correct. The author implements a
complicated beautification of the urls which is a waste in the course
of the examples.

I have the same book, one of the best for learning rails imho.

One other question for you - there are some extra methods that are a
bit confusing, your bin method and the get_stories for example. I
don't think the saving of a few lines of code is worth the possible
confusion.

On Jun 17, 6:32 pm, Omar Renteria li...@ruby-forum.com wrote:
 Well, I'm starting on RoR, so I got a Book called simply
 rails...Following the steps in it sometimes when I try to call a
 property, the browser shows me the next exception:

 undefined method `name' for nil:NilClass

 I don't know why...here's my controller:
 #Controller starts here
 class StoriesController  ApplicationController
   before_filter :login_required, :only = [ :new, :create]

   def index
     get_stories 'votes_count = 5'
   end

   def bin
     get_stories ''
     render :action = 'index'
   end

   protected
   def get_stories(conditions)
     @stories = Story.find :all, :order = 'id DESC', :conditions =
 conditions
   end

   def new
     @story = Story.new
   end

   def create
     #...@story = Story.new(params[:story])
     @story = @current_user.stories.build params[:story]
     if @story.save
       flash[:notice] = La historia a sido agregada correctamente!
       redirect_to stories_path
     else
       render :action = 'new'
     end
   end

   def show
     @story = Story.find_by_id(params[:id])
   end
 end
 #controller ends here

 Here's my view:
 #View starts here
 h2
    %= @story.name %
 /h2
 h3
     span id=vote_score
   Shoveadas = %= @story.votes.size %
     /span
 /h3
 p class=submited_by Agregada por: %= @story.user.login % /p
 p
     %= link_to @story.link, @story.link%
 /p
 div id=vote_form
   % form_remote_tag :url = story_votes_path(@story) do %
     %= submit_tag 'Shovealo!' %
   % end %
 /div
 ul id=vote_history
   % if @story.votes.empty? %
     emSin shoveadas aun/em
   % else %
     %= render :partial = 'votes/vote', :collection = @story.votes %
   % end %
 /ul
 #view ends here

 From now thank you!
 --
 Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Make just one restful action singular

2010-06-20 Thread Agoofin
Can't you declare the resource in the singular form?

http://api.rubyonrails.org/classes/ActionController/Resources.html#M000308



On Jun 20, 3:12 pm, Rory McKinley rorymckinleyli...@gmail.com wrote:
 On 20/06/2010 20:59, Marnen Laibow-Koser wrote:
 snip Wrong.  If that were so, map.resource wouldn't exist.

 snip

 I think I explained myself badly - I am not arguing that you cannot do
 it - but I was stating that for a consumer of the user/edit resource -
 the consumer needs to know internal detail (that the user will be set to
 the current user) to be able to answer the question Which user am I
 editing?.

 With the more explicit version - users/:id/edit - it is more obvious
 which resource is being edited.

 So, whichever one is better depends on the OP's use case and how much he
 wants the consumer to know about the implementation. I tend to err on
 the side of more explicitness with methods that are publicly exposed but
 I am always open to hearing counter opinions on the matter :)

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: RoutingError

2010-06-16 Thread Agoofin
What do you have in your routes.rb file to setup the custom route?

http://guides.rubyonrails.org/routing.html

On Jun 15, 11:27 am, Aashish Kiran li...@ruby-forum.com wrote:
 hi, can anyone help me. i want to create an url to invoke  create action
 of a controller. routes.rb has the routes. But i am getting error at
 line 23. i have @user variable.

 user_contact_path(@user.id)
 I want generate url as : users/3/contacts to invoke contacts
 controller's create action

 -

 ActionController::RoutingError in Contacts#index

 Showing app/views/contacts/index.html.haml where line #23 raised:

 user_contact_url failed to generate from {:controller=contacts,
 :user_id=2, :action=show}, expected: {:controller=contacts,
 :action=show}, diff: {:user_id=2}

 Extracted source (around line #23):

 20:         %p  or
 21:         %p Upload a vCard file to import people into your account.
 22:         %p
 23:           - form_tag(user_contact_path(@user.id), :method = post)
 do
 24:             = file_field_tag file
 25:             = submit_tag
 26:     .span_2
 

 thank you,
 aashish
 --
 Posted viahttp://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 to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] form_remote_tag running only once

2010-06-12 Thread AGoofin
I'm trying to add a simple search to an index page of my project. It
takes a term, does a 'like' query and populates a common partial which
is displayed with javascript in the div 'search_remote'.

It runs fine, once. If you run multiple queries without hiding the
div, it works fine. If you close the div and attempt to search again
you get nothing. The console shows that the controller method is
firing but the div isn't getting updated.

In the view:
  % form_remote_tag :update= search_remote,:url = { :action =
search_remote } do %
%= 'Search for Description:' %
%= text_field description, description %
%= submit_tag 'find' %
  % end %
  div id=search_remote
  /div

In the controller:
  def search_remote
if params[:description]
  search_term = params[:description][:description]
  search_term = '%' + search_term + '%'
  @search_results = Item.find(:all, :conditions = [description
LIKE ?, search_term])
  render :partial = search_remote, :locals = {:aGroup =
@search_results, :show_hide = 1, :aToken= 'search_remote'}

In the partial _search_remote:

%= link_to_remote 'hide',
  :update = 'search_remote',
  :url = {:action = search_remote, :token = 'search_remote' },
  :complete = visual_effect( :blind_up, 'search_remote', :duration =
0.2 )
%

Thanks

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: remote_function return No action responded error

2010-05-23 Thread AGoofin
Do you have the js includes in the application layout?

Happened to me a few times when playing with several projects.

On May 23, 3:09 am, nirosh kunalan.kand...@gmail.com wrote:
 here i given my codes when i execute this remote_function rails give
 me this error

 ActionController::UnknownAction (No action responded to report_poem.
 Actions: create, destroy, edit, index, new, show, update):

 in my view

  span class=report_button onclick=
 %=remote_function(:url={:action=:report_poem,:id=@poem.id})
 %Submit/span

 in my controller

 def report_poem
       @poem = Poem.find(params[:id])
       respond_to do |format|
         format.js
       end
 end

 so anybody know what is the reason is?

 --
 You received this message because you are subscribed to the Google Groups 
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Would you recommend some books about Ruby on Rails?

2010-05-23 Thread AGoofin
The best book on learning Rails that I have ever read is Simply Rails
2 published by Sitepoint (http://www.sitepoint.com/books/rails2/?
historicredirect=rails1 ). It is laid out in a very good way and it's
the only book where I went through all the examples.

Later on I would recommend The Rails Way -http://www.rubyinside.com/
the-rails-way-by-obie-fernandez-679.html
It goes into great detail about Rails.

Remember that Rails 3.0 is just around the corner as well which is a
bit different from 2.0.

On May 22, 12:21 pm, goodchoi good...@gmail.com wrote:
 Hi everybody~
 Vey nice to meet you on this group.

 I'm a only web service planner operating a site 
 http://topics.co.kr/categories?q=iphone
  developed by Ruby-on-Rails engineers through payment.

 But I'm trying to do study Ruby on Rails by myself from now on.

 By the way, some engineers in my country South Korea said the only
 book translated in Korean has wrong exercises now because Ruby on
 Rails is not any more version 1.x.

 So I should buy a book composed by exercise including exercises with
 version 2.x.

 First of all I hope this book [http://amzn.to/bshhvk] is like
 so(above) but I'm not sure.

 And then I hope you great engineers will recommend an appropriate book
 to me, a beginner.

 Thank you geeks.

 --
 You received this message because you are subscribed to the Google Groups 
 Ruby on Rails: Talk group.
 To post to this group, send email to rubyonrails-t...@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: %= % Interpolation question

2010-02-27 Thread AGoofin
%= bar.to_s %

On Feb 27, 11:30 am, Dudebot craign...@gmail.com wrote:
 OK, here's what I have in app/views/molds/show.html.erb:

 trtd%= @mold.body.gsub( \n, br / ) %/td/tr

 The controller finds @patient, and @patient.id = 2

 If @mold.body = The patients id is %= @patient.id %

 Then the view displays

 The patients id is %= @patient.id %

 rather than

 The patients id is 2

 Same goes for replacing %= with #{ and % with }

 Many TIA,
 Craig

 On Feb 27, 10:21 am, Craig White craigwh...@azapple.com wrote:

  On Sat, 2010-02-27 at 07:43 -0800, Dudebot wrote:
   Thanks, Craig--I think my example was too terse.  What I'm trying to
   do is to pass a block of text to a view which may contain multiple
   references to external models, and I'd like to interpolate those
   references.

   So, for example, if @thing.body =  This is the id of foo: %= @foo.id
   % and this is its body: %= @foo.body % 

   If @foo.id = 2 and @foo.body = Norman, I'd like in the view
   whatever.html.erb to have

   %= @thing.body %

   display

   This is the id of foo: 2 and this is its body: Norman

   Is there a way to do that?  I also tried #{ ... } and am still getting
   the literal rather than the interpolation.

  
  try actual code examples

  Craig

  --
  This message has been scanned for viruses and
  dangerous content by MailScanner, and is
  believed to be clean.

-- 
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: possible to set flash within link_to?

2009-11-11 Thread AGoofin

Maybe with some Javascript - link_to_remote? You could also look into
a rjs template which can modify a part of the page - an element, maybe
one named flashing text...

Simply Rails 2 by Patrick Lenz is a very good book which is where I
got the above info.

On Nov 10, 8:06 pm, Arif Bandali rails-mailing-l...@andreas-s.net
wrote:
 hi all,

 i'd like to set the flash to some text when a user clicks a link. i know
 it's possible set a random variable and then it's available in the
 params hash but is it possible to do so with the flash? or do i have to
 create a new action, make the link load the action, and set the flash
 there?

 i want to set the flash in a link_to similar to below:
 %= (link_to SEND, {:controller = company, :action = show, :id
 = current_company.id}) %

 thanks.
 --
 Posted viahttp://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 to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: What's your favorite thing about Rails?

2009-11-01 Thread AGoofin

I wouldn't limit your question to seasoned developers :)

While I wouldn't consider myself seasoned - I've written a few apps
for local use and am getting ready to publish an open source RoR app,
I don't even know how little I know.

Rails makes life easier by it's basic core principles -

Convention over configuration - Do you really need another file in
your app?

DRY - I'm not going to repeat this one

I've looked at different web programming stacks and haven't found
anything close to Rails.

On Oct 30, 2:47 pm, Dustin pixell...@gmail.com wrote:
 What do seasoned developers really enjoy about Rails. How does it make
 your life easier?

 This is for favorites, not what you don't like.

 Thanks,
 Dustin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: *** PLEASE HELP!! *** NoMethodError in AvatarController#upload

2009-11-01 Thread AGoofin

No need to reinvent the wheel with file uploads, I've used PaperClip
to handle uploaded images and files with little trouble.

It's very easy to configure as to where the information gets stored -
in the database or out.


On Oct 31, 8:47 am, RubyonRails_newbie craigwest...@googlemail.com
wrote:
 Hi Everyone!

 I'm trying to add the avatar upload functionality in Ruby on rails
 following the railsspace book.

 Before I got the code and re-wrote it for my own needs, I wanted to
 make sure everything worked anyway, so I added the code from the book
 to the avatar controller etc..

 When I attempted an upload, I got an error:  NoMethodError in
 AvatarController#upload

 So, when I look at the upload function, all seems OK to me. I'm
 running rails 2.3.3 and have managed to get past every issue so far
 without reverting back to an earlier version.

 def upload
     @title = Upload Your Avatar
     @user = User.find(session[:user_id])
     if param_posted?(:avatar)
       image = params[:avatar][:image]
       @avatar = Avatar.new(@user, image)
       if @avatar.save
         flash[:notice] = Your avatar has been uploaded.
         redirect_to hub_url
       end
     end
   end

 Originally it had a problem because of this:

   def index
   #  redirect_to hub_url
   end

 The error with this code in place reads: undefined local variable or
 method `hub_url. This is displayed upon accessing url 
 :http://localhost:3000/avatar

 Can anyone help?

 I might look for another tutorial to upload avatars, but was hoping
 there would be a simple solution..

 Cheers!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Really stuck on nested resources

2009-09-20 Thread AGoofin

One other way to think about this - you shouldn't need to nest
resources more then one level deep.

You only deal with children in relation to parents and dogs in
relation to children. Separate relationships which can be handled
transparently. Plus the links you have to generate get a lot more
confusing - parents_childrens_dog_path( parent_id, child_id, dog_id)
or some such...

On Sep 20, 1:41 pm, mlittle mdlit...@gmail.com wrote:
 MichaelB:

 THANK YOU! So much. Your solution fixed my problem and taught me a
 bunch about rails.

 Thanks again for your help.

 On Sep 20, 8:32 am, MichaelB michael.james.bamf...@gmail.com wrote:

  Hey mlttle-

  You can create a new dog with:

  def create
    @dog = Parent.find(params[:parent_id]).children.find(params
  [:child_id]).dogs.create
  end

  The console is your best friend to quickly diagnose errors:

   @record= parent.child.dog.build(params[:dog])

  NoMethodError: undefined method `child' for #Parent:0x22b6748

  .. becuase your parent model has many **children**

   @record= parent.children.find(child).dogs.build(params[:dog])

  Michael
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: is there a ruby on rails framework/app that would be a good starting point for these requirements???

2009-09-20 Thread AGoofin

Sounds like a cms app for which there was a recent post on the list
for.

 Radiant is probably the best known. AdvaCMS looks quite promising, but
 seems a bit immature at the moment.  There's also BrowserCMS

One that I like is Wagn: http://www.wagn.org/wagn/Introduction

It has a unique card like approach to cms.

Does sound like a project you might be able to build yourself - I
don't know if any of the cms's mentioned will let you serve uploaded
html pages. But you might be able to extend one to do it.


On Sep 20, 3:29 am, Greg Hauptmann greg.hauptmann.r...@gmail.com
wrote:
 Hi,

 Just wondering whether there is an existing open source Ruby on Rails
 app that would be a good starting point for doing this:

 * want a backend web application/service that has an API to allow a
 desktop client application to programmatically upload complete web
 pages (HTML  images that the HTML links to) to be hosted
 * the web application API would have to support (a) create account for
 new user, (b) upload / modify / delete web pages for specified user
 * part of creating the account for user would be to set them up with a
 username/password, as the content needs to be private (user will need
 username/password to access)
 * so each of the accounts (setup with a user password) are all
 separate with no linkages - it's just a service that will allow
 multiple users to have their own HTML/images hosted, and the point
 being that they won't manually set this up themselves, but rather the
 clientside application will have the smarts to do this, therefore
 requires the back-end web application/service to provide the API

 Any existing open source apps sound like they might fit these
 requirements, RoR blog app, or RoR Wiki app or something?  (but it
 needs the programmatic APIs)

 I guess the fallback for me would be to develop a website from the
 ground up to do this (e.g. Ruby on Rails), but it would be nice to
 have something as a starting point.

 Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: how toi incorporate google map in a rails application

2009-09-05 Thread AGoofin

Hmm... that last replay was so helpful I'll really have to try

There is a plugin available - http://ym4r.rubyforge.org/ym4r_gm-doc/
which seems to be coming along nicely. I haven't used it yet so ymmv.

Lot of other ways to do this as well - Google search is your friend
too :)

On Sep 5, 1:05 pm, Soutom soutom.dh...@gmail.com wrote:
 i just want ot incorporate google map in my application. So for this
 what should i do.  if any one please help me step by step...
 thanking you
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: JRuby vs Ruby: why would you ever use ruby?

2009-08-30 Thread AGoofin

I would worry about changes to the Java language that would affect
JRuby. Ruby implementation is never going to be a big concern of the
Java devs, nor should it be.

On Aug 16, 1:45 am, AlwaysCharging goodg...@gmail.com wrote:
 Why would anyone use ruby over Jruby?  I'm admittedly a noob about all
 this stuff, but from what I've read jruby seems superior to ruby and
 quite a bit faster.  What would be the disadvantages of JRuby?  I man
 it's possible to use it with rails now, and JRuby is what's used by
 default in netbeans (which is the ide I think I've settled on).  So
 why not JRuby?  Would the tutorials be all that different?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: REPL in a browser.

2009-08-29 Thread AGoofin

If just want to process some basic commands in a web environment you
could create a form which simply re-displays itself.

Setup a class variable (or simply use the flash notification) to hold
the result of whatever you want to do and instead of redirecting to
show or index, redirect to new. Then display it in your view. You can
assign a blank value for the first run. A simple model could hold the
previous entries and you could iterate over this in the view if you
wanted to show history.

One word of caution though, make sure you have a good grasp on the
security implications before you expose your computer in this fashion.
One bad file i/o call can ruin what might have been a good day.

On Aug 28, 4:44 pm, chris_the_frog cgdjm...@gmail.com wrote:
 Hi! I am a computer science student and I have a problem I just can't
 seem to find an answer to. I would like to embed a read-eval-print-
 loop in a website. Essentially, I'd like a window that mimics a
 console: the user types in some random text, it is processed, a value
 is returned and displayed, and then it waits for the user's input
 again*.  Exactly like a console.

 I am new to Ruby and I have only just begun looking at Rails. In fact,
 I have absolutely no experience in web programming whatever. So even
 if someone could just point me in the right direction, I'd appreciate
 it.

 * FYI, I am trying to create an online version of my research project:
 an interpreter and interactive environment for a small functional
 language.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Complicated polymorphic relation

2009-06-30 Thread AGoofin

First, try not to worry so much about how the tables are set up, you
can create a view to the data to suit your needs. What you need to be
concerned about is how to make the information easy to use and to not
repeat yourself.

As to modeling the data - It seems that the User table would be the
central piece and he or she would have one mandate or perhaps more?
Either has_one or has_many.

It would also seem the user has a location as well as mandate. Another
one to one relationship here and again, the user may have more then
one location - has_one or has_many

Model User
id
name
etc.
Has_one: mandate
has_one: location

Model Mandate
id
user_id
etc.
belongs_to :user

Model Location
id
user_id
etc.
belongs_to :user

Then you could have a look up table for the types of mandates and
locations.

Hope this helps

On Jun 28, 12:48 pm, Adrien Coquio adrien.coq...@gmail.com wrote:
 this solution doesn't fit with my project

 i have to explain :

 the table MANDATES contain the list of possible mandates like :
 (0,mayor,city)
 (1,deputy mayor,city)
 (2,minister,state)
 (3,king,state)
 this list use by me to make a form where the user of my program can
 select the mandate related by user

 the table ELECTED contain the relation between user and mandate like :
 (0,John Smith,mayor,Chicago)
 (1,Brad X,mayor,New York)
 (2,Adrien Y,king,Brasil)
 (3,Anton Z,minister,Great Britain)
 NB: i replace user_id,mandate_id,place_id by user.name,
 mandate.name,place.name

 the solution which i see to do that are :
 1)i have explain in the first post
 2) duplicate the field place_type in the table ELECTED (maybe it is
 the easier solution?)
 3) group tables MANDATES and ELECTED like that :
 MANDATES
 - id
 - name
 - place_id
 - place_type
 - user_id
 in that way i create all possible mandates with no user related to
 make the form and when i have a relation between user/mandate i create
 a copy of the mandate with the user_id

 what do you think about this solution?

 thanks

 adrien

 On Jun 28, 5:12 pm, Marnen Laibow-Koser rails-mailing-l...@andreas-

 s.net wrote:
  Adrien Nom wrote:
   I want to do that way because i must save the possible mandates in one
   table.

  That's not a good rationale.  The place_id is part of the mandate just
  as much as the olace_type is, so it belongs in the mandates table.

   Then i use an other table to save the relation between mandates
   and users.
   How can i do that with an other way ?

  If I understand you correctly, this will be very easy with your current
  schema, once you make the change I am proposing.

  Basically, place_id is a property of the mandate, so it belongs in the
  mandates table.  Since you have mandate_id in elected, you can get the
  place_id with something like @elected.mandate.place_id.

   thanks for your answer
   adrien

  Best,
  --
  Marnen Laibow-Koserhttp://www.marnen.org
  mar...@marnen.org
  --
  Posted viahttp://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 to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How to sanitize a link?

2009-06-30 Thread AGoofin

Take a look at: http://guides.rubyonrails.org/security.html

and then look at what you're trying to provide.

Is it really worth the risk?

A compromise might be http://redcloth.org/ a Textile to Ruby module

On Jun 29, 5:59 pm, Xdmx Xdmx rails-mailing-l...@andreas-s.net
wrote:
 Hi, i wan't to permit users to send their own content, text, html, and
 stuff like that. It should also be permit them to send their own design,
 using div, span, internal style attributes and so on. Obviously i'd like
 to protect everything forbidding javascript, but permitting object and
 embedded (for youtube, gvideo, etc).
 From a previous post the suggestion was 
 wonko/sanitize:http://www.ruby-forum.com/topic/186697
 But i've not found time to try it yet.
 Btw, my question now is another, how can i remove external links, but
 keeping the text link and internal links?
 I mean, if a user insert a href=http://externaldomain.com;my
 site/a it should be sanitized to just my site, instead if he insert
 a href=http://domain.com;read this page/a it should keep it as it
 is (domain.com is whitelisted). And it also should remove others like
 mailto:, ftp:, etc (just keep http and https)
 Any hint about this ? (considering the first lines about styles, and
 which sanitezer to use)
 thank you
 --
 Posted viahttp://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 to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How to get value from view?

2009-06-08 Thread AGoofin

It seems like the two controllers could be combined. Validating the
card and choosing a subscription type would be part of the same order,
so you could add the subscription types to the credit card controller
as an instance variable.



On Jun 8, 5:05 am, Vikas Gholap rails-mailing-l...@andreas-s.net
wrote:
 Hello all,

 I have following problem,

 I have a view called new_sub_type.html.haml and controller
 SubscriptionTypes. In this view i'm showing a dropdown list of
 subscription types.

 When user submit form, I show another view new_credit_card.html.haml
 which is in controller CreditCards. This form is submitted to
 SubscriptionTypes controller.

 Then i validate credit card information in SubscriptionTypes
 controller.

 if credit card info is not valid then i redirect to again credit cards
 new.html.

 When user select value subscription type from first form, I want to
 use that subscription type value in SubscriptionTypes controller.

 I don't know how to get that value? i used session.then I get value of
 subscription type, but if credit card info is not valid I get nil
 value when redirected to new_credit_card.html.haml?

 Is there another way?

 Thanks,
 Vikas.
 --
 Posted viahttp://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 to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: GeoLocation for any Cell Phone with GPS

2009-06-07 Thread AGoofin

A quick Google search turned up a few possibilities:

(ruby geolocation)
http://earthcode.com/blog/2007/02/geokit_map_plugin.html

There are a few ways though to take a lat/long and transpose them to a
map or do other fun things with them.  Try looking at Google maps as
well.

On Jun 6, 1:47 pm, flaubert aflaube...@gmail.com wrote:
 Hi all,

 I'm having the following problem: I need a user using any device of
 any GPS is advised that at a certain place. I search on the net with
 articles on Global Positioning RubyonRails, but without success.

 Can anyone help me?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How do i model this in Rails? (put down java equivalent design)

2009-06-07 Thread AGoofin

Does seem to be a bit of repetition in your description but it seems
straightforward.

You have a Module which has an Entity_type column

Each Module has many Chapters where Chapters has a column named
module_id.

Each Chapter has many Activities with similar foreign key constraints
or
You have one Activities table, in which case you don't specify a
relationship.

Once you set up the has_many and belongs_to pairs, Rails provides the
methods to interact with the data.

Checkout some ActiveRecord tutorials like this screencast -
http://www.railsenvy.com/2007/8/8/activerecord-tutorial

On Jun 6, 10:29 pm, Ritvvij ritvi...@gmail.com wrote:
 Hello guys,

 Need help!! Finding it hard to model the 'model' :P within the given
 rails associations.

 In java terms, my requirements are...

 There are 3 entities - module, chapter and activity.

 Chapter entity is a specilization of Module entity (inheritence)
 Activity entity is a specialization of Module entity (inheritence)
 And the tables would have looked like:
 1. Module table = Module_Id, Entity_type, 
 2. Chapter = Chapter_id, .
 3. Activity = Activity_id, ..

 Hence, if I create a chapter then the tables would be populated as:
 Module table = Module_Id, Entity_type,  = values ( 100,
 chapter ,  )
 Chapter table = chapter_id, . = values ( 100,  )
 Basically, the ids of chapter and module would be same and module
 table would store the type.

 Now, if I create a activity then the tables would be populated as:
 Module table = Module_Id, Entity_type,  = values ( 101,
 activity ,  )
 Activity table = activity_id, . = values ( 100,  )
 Basically, the ids of activity and module would be same and module
 table would store the type.

 Can you please guide me how I can model it similarly in rails 2.3.2?

 Thanks in advance
 Ritvvij Parrilkh
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: can't get a simple partial to work !...@#!$!!

2009-05-10 Thread AGoofin

Perhaps you should look at the whole of DHH wrote. It is perhaps
something like: render :partial = 'test' or has a :test = @var
clause to give the test variable.

The code you posted doesn't contain any variable named test, otherwise
you wouldn't get the error in the first place.

If you want the code to work, replace 'test' in the index view with
'@array'



On May 10, 1:35 am, 7stud -- rails-mailing-l...@andreas-s.net wrote:
 AGoofin wrote:
  When you render a partial you automagically get an object with the
  same name available in the partial

  For example, render :partial = 'foo' passes the instance variable
  named @foo to  the partial where I can then say: for f in @foo.

 How do you know that @foo isn't already available to all the views and
 that writing render(:partial = foo) doesn't have any effect whatsoever
 on whether @foo is available in the partial?

  In your first post you iterate over 'test' but that variable isn't
  created anywhere.

 Sure it is.  Try it.  I'm just a beginner but my Dave Heinemeier Hansson
 book says the variable test gets created by the render() statement, and
 my tests confirm that's the way it works.  More generally, when I write

 % render(:partial = random_name, :object = @var) %

 and @var was assigned a value in the controller, then I find that the
 value of @var gets assigned to the variable random name, and
 random_name can be accessed in the partial _random_name.html.erb.  In
 addition, my tests show that @var can be accessed in
 _random_name.html.erb as well.  I'm not sure why you would want to stuff
 the value of @var into another variable when you can just access @var
 directly.  Switching the names seems confusing to me.

 --
 Posted viahttp://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 to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: can't get a simple partial to work !...@#!$!!

2009-05-09 Thread AGoofin

When you render a partial you automagically get an object with the
same name available in the partial

For example, render :partial = 'foo' passes the instance variable
named @foo to  the partial where I can then say: for f in @foo.

In your first post you iterate over 'test' but that variable isn't
created anywhere.

Using: for a in @array might work providing that the partial is part
of that controller though. Or rename @array to @test.

I don't know how many times I have stopped and looked for the
painfully obvious - like with RESTful resources - the key is to make
that part of the trouble shooting.

On May 9, 1:47 am, 7stud -- rails-mailing-l...@andreas-s.net wrote:
 Rick Lloyd wrote:
  views/store/index.html.erb:

  %= render(:partial = layouts/test, :object = @array) %

  views/layouts/_test.html.erb:

  % for num in test %
   div%= num %/div
  % end %

 Sorry,  I don't know what that means, and I still can't solve my
 original problem, which led to the test code in my op.  Here is what I
 have now:

 class StoreController  ApplicationController
   def index
     @products = Product.find(:all)
   end

   def add_to_cart
     @cart = [1, 2, 3]
   end
 end

 layouts/store.html.erb
 ---
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
        http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;

 html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en
 head
   meta http-equiv=content-type content=text/html;charset=UTF-8 /
   title% @page_title || Store %/title
   %= stylesheet_link_tag 'scaffold', 'store2.css' %
 /head
 body

   div%= render(:partial = cart, :object = @cart) %/div

 /body
 /html

 views/store/_cart.html.erb
 ---
 % for num in cart -%
 div%= num %/div
 % end %

 When I go tohttp://localhost:3000/storein my browser, I get this:
 -
  NoMethodError in Store#index

 Showing app/views/store/_cart.html.erb where line #1 raised:

 You have a nil object when you didn't expect it!
 You might have expected an instance of Array.
 The error occurred while evaluating nil.each

 Extracted source (around line #1):

 1: % for num in cart -%
 2: div%= num %/div
 3: % end %

 Trace of template inclusion: app/views/layouts/store.html.erb
 --

 --
 Posted viahttp://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 to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: referential integrity

2009-04-13 Thread AGoofin

Your Team has many members and should be noted:

class Team  ActiveRecord::Base
has_many :members
end

This is assuming that you have a column in your member table named
team_id. I think this is what you were asking about with the foreign
keys.

As a somewhat noob to Rails myself I found a few good books for
beginners to be the most help. The two I like the best are: Simply
Rails 2 and Agile Web Development with Rails.


On Apr 13, 7:43 pm, Andrew France andrew+li...@avito.co.uk wrote:
 On Apr 13, 11:06 pm, doughie eamonn.fahe...@gmail.com wrote:

  question 1) should there be foreign key relations in mysql db?  I used
  the script/generate model and then rake db:migrate

 Rails has no native support for foreign key constraints in the DB. I
 use the RedHillOnRails Core plugin, unfortunately there main site went
 offline not long ago but you can get the plugin 
 from:http://github.com/harukizaemon/redhillonrails_core/tree/master. This
 allows you to specify foreign keys in migrations if you want the
 database to maintain referential integrity for you (dunno who
 wouldn't!).

  question 2) in my conceptual model my developer belongs to a team.  So
  i have the model above.  Should there be a relationship in team
  describing how the link exists to developer? Currently mine is empty:
  class Team  ActiveRecord::Base
  end

 You would say has_many :developers. The Rails API
 ActiveRecord::Associations documentation provides an in-depth
 discussion of relations.

 Best regards,
 Andrew

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---