Re: [Rails] database save files

2011-10-03 Thread Chris Kottom
>
> How to save a text file to database by mysql.
>

If you've already got the information as a file and you're going to need it
as a file in the future, then you should just store it as a file for later
use.  There are a lot of gems that can help you with this sort of thing.
See: http://ruby-toolbox.com/categories/rails_file_uploads.html.

-- 
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.



Re: [Rails] [Learning] How much ruby should one know before learning Rails?

2011-09-04 Thread Chris Kottom
>
> Should i learn more ruby and get more fluent with it, cos ultimately i will
> be writing ruby in rails.
> or
> Start learning rails with my limited ruby knowledge and learn the rest by
> doing. (learning by doing method).


Given what you've said, I would begin by working on some basic Rails
applications and picking up essential Ruby concepts that way.  Most Rails
applications will only ever use a subset of the language, so you'll quickly
find out which constructions and techniques are common and which are less
used.  But because Rails is Ruby, you shouldn't expect that there's a
canonical checklist of Rubyisms that are needed for writing Rails apps.  The
knowledge required to build and maintain an app is going to depend on the
application, and as with anything, There's More Than One Way to Do It.

Recommend the Agile Web Development with Rails book from the Pragmatic
Programmers as a practical way of getting started with Rails development
including the framework, Ruby language, development process, etc.

On Sun, Sep 4, 2011 at 7:07 AM, Naveen Kumar wrote:

> *This is where i stand :*
>
>
>- I learnt programming on my own by learning Python ( intermediate ).
>- I have no programming experience.
>- I only know the basic programming concepts (OOPs, metaprogramming,
>testing etc.) in both ruby and python.
>- I only wish to do web development stuff and NO hardcore programming
>stuff.
>
>
> *What now ?*
>
> Should i learn more ruby and get more fluent with it, cos ultimately i will
> be writing ruby in rails.
> or
> Start learning rails with my limited ruby knowledge and learn the rest by
> doing. (learning by doing method).
>
> OPTIONAL:
> Also it will be of great help to me and other newbies if someone could post
> the list of minimum ruby concepts (loops,symbols,oops etc) that one should
> know before learning Rails.
>
> Thanks in advance.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/zy7lmt4bg34J.
> 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.
>

-- 
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.



Re: [Rails] Use Rails Bootstrap to create a boilerplate project and kickstart development

2011-09-03 Thread Chris Kottom
>
> It lets you create a boilerplate Rails project, furnished with all the
> gems, libraries and dependencies you need to get started immediately.


Why wouldn't you do this using a Rails application template?

On Sat, Sep 3, 2011 at 3:27 AM, Chetan Surpur  wrote:

> Hey everyone,
>
> I just created a quick little project called Rails Bootstrap, that I
> thought you might find useful. It lets you create a boilerplate Rails
> project, furnished with all the gems, libraries and dependencies you need to
> get started immediately. Check it out here:
>
> https://github.com/chetan51/rails-bootstrap
>
> And please do let me know if you have feedback!
>
> Thanks,
> Chetan
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/jnYAWWryEjcJ.
> 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.
>

-- 
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.



Re: [Rails] Question about rails generate controller

2011-08-09 Thread Chris Kottom
No, but you can call this:

rails generate controller ControllerName index add update

On Tue, Aug 9, 2011 at 4:17 PM, Pepe Sanchez  wrote:

> Hi all
>
> Is there a way to run 2 or more times the controller command to add
> methods to a specific controller?
>
> can I run:
>
> rails generate controller ControllerName index
>
> rails generate controller ControllerName add
>
> rails generate controller ControllerName update
>
> thanks
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] How do I select the include order of CSS/SASS files?

2011-08-08 Thread Chris Kottom
At the top of your app/assets/stylesheets/application.css file you should
see something like this.
/*
 * This is a manifest file that'll automatically include all the stylesheets
available in this directory
 * and any sub-directories. You're free to add application-wide styles to
this file and they'll appear at
 * the top of the compiled file, but it's generally better to create a new
file per style scope.
 *= require_self
 *= require_tree .
 */

The two comments at the bottom tell Sprockets to build a compiled asset file
using first the contents of this file and then the contents of every other
file in this directory.  If the import order matters to you, you'll need to
replace the require_tree directive with individual requests to require each
file in the order you need.  Ex:
/*
 * This is a manifest file that'll automatically include all the stylesheets
available in this directory
 * and any sub-directories. You're free to add application-wide styles to
this file and they'll appear at
 * the top of the compiled file, but it's generally better to create a new
file per style scope.
 *= require_self
 *= require reset
 *= require layout
 *= require fonts
 *= require ...
 */


On Mon, Aug 8, 2011 at 5:34 AM, Ezequiel Schwartzman
wrote:

> Hello, I'm tweaking around with SASS and I'm kind of stuck here.
>
> I did a /app/assets/stylesheets/reset.css.scss file, surprisingly it's
> included automagically in all controllers.
>
> The problem is that it's included after the layout CSS and before the
> controllers CSS, and I need it to be included after everything =/
>
> How do I specify this?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] Upload and display image

2011-08-05 Thread Chris Kottom
Check out:
http://railscasts.com/episodes/134-paperclip
http://railscasts.com/episodes/182-cropping-images


On Fri, Aug 5, 2011 at 10:54 AM, SW Engineer  wrote:

> Are there tutorials that show you how to build an RoR application where
> you can upload and display images?
>
> Thanks.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] Re: How to keep the rails server always ON?

2011-08-04 Thread Chris Kottom
Webrick is the default web server that runs when you type rails server.
 When you're running it in development mode, it will reload any code changes
that you might happen to make on each request, but it won't be able to pick
up changes to configuration files and Ruby gems that are loaded only at
server startup time.  Furthermore, if you're just learning Ruby / Rails,
you're going to make a lot of mistakes, and having the web server console
output to refer to whenever something blows up is going to be useful.
 Having your server running in the background is going to take all that away
from you.

When I'm working on a project, I keep a server up and running in its own
terminal window pretty much all the time and restart it whenever I need to
pick up a configuration change.

On Thu, Aug 4, 2011 at 11:07 AM, Sayuj Othayoth wrote:

> hey Rubyist, those are web servers. You need to configure the web server.
> -
> sayuj
>
>
> On Thu, Aug 4, 2011 at 12:28 PM, Rubyist Rohit wrote:
>
>> Is this a command that I have to type in the command prompt? I am using
>> Windows 7.
>>
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, 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.
>>
>>
>  --
> 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.
>

-- 
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.



Re: [Rails] Facebook/Twitter Share Button on RoR

2011-08-04 Thread Chris Kottom
These are simple HTML/JavaScript drop-ins.  You don't need to involve
anything in the Rails stack beyond placing the required markup in your
template.

https://twitter.com/about/resources/tweetbutton
http://developers.facebook.com/docs/reference/plugins/like/

On Thu, Aug 4, 2011 at 10:01 AM, Sayuj Othayoth wrote:

> Hi comrades,
>
> I want to place fb and twitter share button on my page.
>
> What is the best way to integrate RoR with FB/Twitter
>
> -
> Sayuj Othayoth
>
> --
> 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.
>

-- 
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.



Re: [Rails] [root :to => "home#index"] not working

2011-08-03 Thread Chris Kottom
What's the error?  What do you see when you run rake routes on the command
line?  Need more information.

On Wed, Aug 3, 2011 at 9:44 AM, G S RAO  wrote:

> If you can able to put the total error page, then we know what is the exact
> error.
>
>
> On 3 August 2011 12:30, Rubyist Rohit  wrote:
>
>> I have done the changes in the file config/routes.rb as mentioned in the
>> Rails Guides tutorial, but when I try to open:
>>
>> http://localhost:3000
>>
>> the page is not opening. It is giving error.
>>
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, 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.
>>
>>
>
>  --
> 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.
>

-- 
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.



Re: [Rails] Re: How to design and write my first blog using RoR?

2011-08-02 Thread Chris Kottom
Lots of people, especially beginners, copy and paste a lot of code.  Just
about everyone's done it, and it's a great way to get started and get
something that works, but the resulting code can be brittle and hard to
maintain because you've got the same or similar logic spread out everywhere.
 Classes and OO are tools, but they don't insure against bad coding
practices.

You'll hear the term "refactoring" a lot.  Look it up, and get to know what
it means.  It's how you get from the kind of spaghetti I was describing to
high-quality, DRY code.

On Tue, Aug 2, 2011 at 12:53 PM, Rubyist Rohit  wrote:

> Isn't the concept of Classes mean this? Does Ruby has something more
> advanced?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] Re: How to design and write my first blog using RoR?

2011-08-02 Thread Chris Kottom
>From Wikipedia (which is the first Google result for "don't repeat
yourself"):

In software engineering 
, *Don't Repeat Yourself* (*DRY*) or *Duplication is Evil* (*DIE*) is a
principle
 of software 
development
aimed
at reducing repetition of information of all kinds, especially useful
in multi-tier
architectures . The
DRY principle is stated as "Every piece of knowledge must have a single,
unambiguous, authoritative representation within a system."


On Tue, Aug 2, 2011 at 12:36 PM, Rubyist Rohit  wrote:

> 7stud -- wrote in post #1014420:
> > Rubyist Rohit wrote in post #1014419:
> >
> > Situation 1:  you have a method with 20 lines of code that performs a
> > calculation, and every time you need to execute that code you call the
> > method.
> >
> > Situation 2: every time you need to do do the calculation, you write the
> > 20 lines of code in your app.
> >
> > Which situation would you deem to be the one that repeats itself?
> >
> > edit: Upon rereading your question, I have no idea what you are asking.
>
> I mean, what is meant by DRY methodology of Ruby? If it insists to
> re-use code, then this paradigm is already there, from before Ruby.
>
> What exactly is meant by: "Don't Repeat Yourself"?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] How to design and write my first blog using RoR?

2011-08-02 Thread Chris Kottom
If you're really interested in learning Rails and your first step is going
to be writing HTML and CSS, you might be doing it wrong.  Same thing with
focusing on the editor you use.

Watch the flow in the Rails blog example video link (or the Rails guide that
Martin linked to), and notice the flow of development.  Then try writing
your own code (borrowing heavily from these materials) to built your own
app.

On Tue, Aug 2, 2011 at 11:23 AM, Dhaval Mehta <2010dha...@gmail.com> wrote:

> http://guides.rubyonrails.org/getting_started.html
>
> is the best site for new ROR developer..
>
> and it also show how to create simple blog ..
>
> Best of luck..
>
>
>
> On Tue, Aug 2, 2011 at 2:26 PM, Rubyist Rohit wrote:
>
>> I want to design a blog using RoR. It is also my initial step with RoR.
>> I want to learn both Ruby and Rails with this real-life project that
>> will be live on the net.
>>
>> Since I am from a .NET background, I use a language of Toolbox with
>> Controls on it. How to display blog posts one after the other as we see
>> in blogs? Is there any Ruby control that is similar to .NET Repeater
>> control?
>>
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, 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.
>>
>>
>
>
> --
> *Regards,
> Dhaval Mehta*
>
>
>  --
> 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.
>

-- 
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.



Re: [Rails] Re: How to design and write my first blog using RoR?

2011-08-02 Thread Chris Kottom
And if you need an app to copy...
http://weblog.rubyonrails.org/2008/11/27/new-15-minute-blog-video-on-rails-2-2

It's not the latest and greatest version, but it will get you started.  Set
your sights low initially, and plan to throw the first version away.

On Tue, Aug 2, 2011 at 11:00 AM, 7stud --  wrote:

> Rails is too complicated. The typical way to learn rails is to copy an
> app out of a book, and you will have very little understanding of what
> is going on--especially if you don't know ruby at an intermediate level.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] Rails and Service Oriented Architecture (SOA): any downsides?

2011-08-02 Thread Chris Kottom
SOA and performance are two of the most abused terms in IT, so definitions
matter a lot.  I take the first to mean a set of principles applied to the
design and development of systems and complex solutions (go to Wikipedia or
Google define:SOA for a list) and the second as the ability of a system or a
component of a system to do its work efficiently (more operations in the
same amount of time, the same number of operations in a shorter time).  That
being the case, I have a hard time understanding the original question
because all of these concepts seem to be more or less orthogonal to one
another.  Architecture and implementation technology are certainly going to
have an effect on performance, but they don't determine performance or
scalability (related term, though not the same, also badly abused) as much
as how they're applied which is largely determined by application complexity
and the skill of the development team.

See http://railslab.newrelic.com/scaling-rails for an introduction to things
that do matter when designing and testing a Rails application for speed.

I have the feeling that none of the answers you've received are really
answering your question though.  Could you further specify what you've heard
and what you're looking to find out?

On Tue, Aug 2, 2011 at 8:35 AM, Colin Law  wrote:

> On 29 July 2011 16:02, Lille  wrote:
> > Hey folks,
> >
> > I like what I'm reading about improved performance via Service
> > Oriented Architecture for my Rails app.
>
> I don't see how SOA improves performance, have you some references for
> this assertion?
>
> Colin
>
> > Stepping in that direction
> > will require some code reorganization, though. Has anyone regretted
> > the time invested in Rails SOA or suffered any other drawbacks that
> > might -- from a business perspective -- have disinclined them from
> > going SOA?
> >
> > Lille
> >
> > --
> > 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.
> >
> >
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Re: setting an extra attribute of the join model.

2011-08-01 Thread Chris Kottom
Well then you need to go with an alternative that allows the user to add
rows to the form using some dynamic HTML.  I'd get it working with a static
version as I've suggested first and then try to adapt it to this
requirement.

On Mon, Aug 1, 2011 at 1:43 PM, Mauro  wrote:

> On 1 August 2011 13:35, Chris Kottom  wrote:
> > No reason.  It can be whatever number of times you decide.  If you want
> to
> > show the user a form with 10 delivery items, then it would be 10.times.
>
> That's difficult because is the user that decide how much products
> deliver and then how much delivery_items contains a delivery.
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Re: setting an extra attribute of the join model.

2011-08-01 Thread Chris Kottom
No reason.  It can be whatever number of times you decide.  If you want to
show the user a form with 10 delivery items, then it would be 10.times.

On Mon, Aug 1, 2011 at 1:30 PM, Mauro  wrote:

> On 1 August 2011 12:20, Chris Kottom  wrote:
> > Never used simple_form, but I'd try it like this.  Forgive me if the
> syntax
> > isn't quite right.
> > controller:
> >
> > def show
> >
> >   @customer = Customer.find(params[:id])
> >   @delivery = @customer.deliveries.build
> >
> >   3.times { @delivery.delivery_items.build }ù
>
> why 3.times?
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Re: setting an extra attribute of the join model.

2011-08-01 Thread Chris Kottom
Never used simple_form, but I'd try it like this.  Forgive me if the syntax
isn't quite right.

controller:

def show

  @customer = Customer.find(params[:id])
  @delivery = @customer.deliveries.build
  3.times { @delivery.delivery_items.build }

  @products = Product.all
  @products_selected = []
  Settings.default_delivery.products.each{|product| @products_selected
<< product.id_value}


form:
= simple_form_for @customer do |f|
  = f.simple_fields_for :deliver do |deliveries_f|
 = deliveries_f.input :notes
= f.simple_fields_for :delivery_items do |delivery_items_f|
= delivery_items_f.association :product, :multiple => false, :selected
=> @products_selected,
:input_html => { :title => "- Select product
-" }, :label => false
= delivery_items_f.input :quantity

Essentially, you're using the same technique of building the DeliveryItems
under the Delivery just as you built the Delivery under the Customer.  With
this technique, you're limited to defining a fixed number of DeliveryItems
before the form is produced, but adding a dynamic element that would add
more rows if the user needs them should be trivial.

HTH

On Mon, Aug 1, 2011 at 10:41 AM, Mauro  wrote:

> On 1 August 2011 08:22, Chris Kottom  wrote:
>
> > Add an accepts_nested_attributes_for call to Delivery for
> :delivery_items.
>
> done
>
> > Add a quantity attribute to DeliveryItem
>
> already done
>
> > Change the form from a single select with a list of Products to a number
> of
> > rows, each with a single-item select for Product and a text field for
> > entering quantity.
>
> But DeliveryItem belongs_to :product so to add, say three products, I
> have to create three delivery_items submitting the form three times.
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Re: setting an extra attribute of the join model.

2011-07-31 Thread Chris Kottom
I think your problem is in the way you've used the AR relationships in
constructing the form you have there.  Your form is using the
has-many-through relationship from Delivery to Product to construct the
form.  This was all right before you had anything meaningful at the
DeliveryItem level, but now the whole form needs to be reworked to stop
thinking of Delivery as a bunch of Products and instead as a number of
DeliveryItems, each of which is associated with a Product.

I haven't had to do anything like this before, but I would try to solve it
as follows:

   1. Add an *accepts_nested_attributes_for* call to Delivery for
   :delivery_items.
   2. Add a quantity attribute to DeliveryItem
   3. Change the form from a single select with a list of Products to a
   number of rows, each with a single-item select for Product and a text field
   for entering quantity.


On Mon, Aug 1, 2011 at 12:50 AM, Mauro  wrote:

> On 31 July 2011 22:52, Conrad Taylor  wrote:
> > On Sun, Jul 31, 2011 at 1:47 PM, Conrad Taylor 
> wrote:
> >>
> >> On Sun, Jul 31, 2011 at 11:12 AM, Mauro  wrote:
> >>>
> >>> On 30 July 2011 21:22, Mauro  wrote:
> >>> > https://gist.github.com/1114858.
> >>> > How can I set the quantity DeliveryItem in the same form so that when
> >>> > I update the customer attributes the Delivery is created with
> products
> >>> > and their quantity?
> >>> >
> >>>
> >>> no solution?
> >>>
> >>
> >> Mauro, I'm not 100% sure what you're trying to ask here.  Thus, could
> you
> >> explain
> >> the steps starting with how the user would interact with the form to
> >> what you would
> >> like to happen?  For example,
> >> a)  The user navigates to the page containing the form.
> >> b)  The user does X
> >> c)  ...
>
> Ok, sorry but my english is really bad..
> Then, as you see in the code the Customer has many deliveries and one
> Delivery has many products through delivery_items.
> I want to do this: I call the show action for Customer;
> I view customer details and a form to create a delivery for that customer.
> The delivery has one or more products.
> When I submit the form it creates the delivery for the customer with
> one or more delivery_items, that is the join model.
> The delivery_item contains the product but the quantity attribute is
> nil, I want to populate the quantity when the delivery was created so
> that the delivery has products with their quantity.
> >
> > Or do you have tests which might add some clarity to what you're trying
> to
> > achieve?
> >
> >>
> >> -Conrad
> >>
> >>>
> >>> --
> >>> 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.
> >>>
> >>
> >
> > --
> > 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.
> >
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Re: scope determined by model function call

2011-07-29 Thread Chris Kottom
I probably wouldn't go as far as you have in breaking status out into a
separate model.  I'd keep it as an attribute of contract and use
ActiveModel::Dirty along with an ActiveRecord after_save callback to handle
updates into a contract_status_changes table.

Alternately, you could use something like AASM to implement a finite state
machine and add rows to the history table using events / transitions.

On Fri, Jul 29, 2011 at 10:56 AM, paulo  wrote:

> Don't suppose anyone has any thoughts regarding this?
>
>
> Thanks
>
>
> Paul
>
> On Jul 27, 12:19 pm, paulo  wrote:
> > Hi All,
> >
> > I can work around this if it isn't possible, but I am looking to
> > create a scope for a model which returns records based on the result
> > of a model function.
> >
> > Essentially, I have the following:
> >
> > class contract
> >   has_many contract_statuses
> >
> >   def current_status(date)
> > 
> >   end
> > end
> >
> > class contract_status
> >   belongs_to :contract
> >   belongs_to :status
> > end
> >
> > class status
> >   has_many :contract_statuses
> > end
> >
> > The contract_statuses are there to track the status of a contract over
> > time with the latest being the current status for a particular
> > contract. A 'status' simply has a 'name' field.
> >
> > In my contract model, i have a current_status function which returns
> > the contract_status record that was relevant as a particular time,
> > given a date parameter.
> >
> > The scope I would like would be something like contracts.active, where
> > active relates to the name of the current status. Ideally, I would
> > like to get the status through the current_status method of the
> > contract, but I've not been able to find a way to do this in a
> > scope.
> >
> > Is this possible?
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Re: Question regarding associations..

2011-07-29 Thread Chris Kottom
One of my favorite phrases on this mailing list: "Yeah, what Fred said."
 Migrations store information about your database, models store information
about your classes, even though the differences right now might not be
completely clear.  Associations require a foreign key to map to (e.g. as
denoted by "references" or actually creating an integer column with an
appropriate name) on one of your tables, and the bidirectional relationships
should be set up in your models (e.g. subclasses of ActiveRecord::Base).

Another small protip if I can offer it: never name anything "test" as you've
done with your application.  It's not a reserved word, there's no specific
restriction against it, but I've had any number of situations where things
started behaving strangely as a result of naming some thing in my
application using a term that already has a meaning.

On Fri, Jul 29, 2011 at 10:20 AM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
> On Jul 29, 9:06 am, Rick & Nellie Flower  wrote:
> > Chris --
> >
> > one more question if you don't mind too much!  So, I blew away everything
> and started over this
> > time using just the command line tools w/o fiddling around (at least
> outside of adding the enum
> > pieces -- which seem on the surface like they might plug into the
> generator).. Below are the commands I use and works (sort-of) when using the
> web-interface tohttp://localhost:3000/users/new
> >
> > However, I don't believe it's creating the associations correctly -- the
> "has_one" is incorrect as it's
> > kicked out when issuing the initial migrate to setup the database..  Do I
> need to put the has_one
> > in by hand or is my syntax messed up?  I was looking over the api-docs
> and thought i had it right
> > but perhaps not.  Below are the commands I issued :
> >
>
> > 1) rails new test
> > 2) rails generate scaffold user address:has_one acct_locked:boolean
> family_id:integer is_profile_setup:boolean last_login:datetime
> password:string security_question:string security_answer:string
> username:string type:string
> > 3) rails generate model address user:references street:string city:string
> state:string zip:string email:string phone:string
> > 4) bundle exec rake db:migrate
>
>
> has_one doesn't belong in your migration/scaffold stuff. Add it to the
> model later on. (belongs_to/references is the exception to this,
> because user belongs_to :blah actually requires adding a column to the
> users table whereas user has_one :blah doesn't)
>
> Fred
> >
> > I get this on step #4 above :
> > rake aborted!
> > An error has occurred, this and all later migrations canceled:
> >
> > undefined method `has_one' for
> #
> >
> /Users/nrf/.rvm/gems/ree-1.8.7-2011.03/gems/activerecord-3.0.9/lib/active_r
> ecord/connection_adapters/abstract/schema_definitions.rb:326:in
> `method_missing'
> >
> > Ugg..
> >
> > On Jul 28, 2011, at 11:50 PM, Chris Kottom wrote:
> >
> >
> >
> > > If you want to do revisions on existing tables (adding columns,
> changing data types, etc.) you can use migrations for that as well.
>  Experiment on the command line with patterns like:
> >
> > > rails g migration add_columns_to_addresses column_1:string
> column_2:integer ...
> > > rails g migration remove_columns_from_addresses column_1:string
> column_2:integer ...
> >
> > > The generator will try to figure out what you're attempting to do if
> you give it some basic instructions and if what you want to do isn't too
> complicated.
> >
> > > On Fri, Jul 29, 2011 at 8:35 AM, Rick & Nellie Flower <
> n...@ca-flower.com> wrote:
> > > Thanks for the reply Chris..
> >
> > > I'll switch away from Camelcase.. I use that at work all day long (C++)
> so I'm used to looking at
> > > it.
> >
> > > I initially used the generator but when revising tables it didn't want
> to run anymore complaining
> > > some of the files were already there -- which is why I resorted to
> hand-edits.  I'll do some more
> > > reading on what you suggested.. Thx!
> >
> > > -- Rick
> >
> > > On Jul 28, 2011, at 11:22 PM, Chris Kottom wrote:
> >
> > >> Are you not using generators for the initial creation of your model
> and migration source files?  I'm asking because I think I can count on one
> hand the number of times I've ever written out a create_table function
> myself.  Your inputs from the command line should do all this for you alo

Re: [Rails] Question regarding associations..

2011-07-28 Thread Chris Kottom
If you want to do revisions on existing tables (adding columns, changing
data types, etc.) you can use migrations for that as well.  Experiment on
the command line with patterns like:

rails g migration add_columns_to_addresses column_1:string column_2:integer
...
rails g migration remove_columns_from_addresses column_1:string
column_2:integer ...

The generator will try to figure out what you're attempting to do if you
give it some basic instructions and if what you want to do isn't too
complicated.

On Fri, Jul 29, 2011 at 8:35 AM, Rick & Nellie Flower wrote:

> Thanks for the reply Chris..
>
> I'll switch away from Camelcase.. I use that at work all day long (C++) so
> I'm used to looking at
> it.
>
> I initially used the generator but when revising tables it didn't want to
> run anymore complaining
> some of the files were already there -- which is why I resorted to
> hand-edits.  I'll do some more
> reading on what you suggested.. Thx!
>
> -- Rick
>
> On Jul 28, 2011, at 11:22 PM, Chris Kottom wrote:
>
> Are you not using generators for the initial creation of your model and
> migration source files?  I'm asking because I think I can count on one hand
> the number of times I've ever written out a create_table function myself.
>  Your inputs from the command line should do all this for you along with
> some of the work of setting up your model associations (e.g. the belongs_to
> call in your Address class definition) and save you some effort.  If you're
> using the generators properly, you may never have to touch the migration
> files for simpler applications.
>
> rails g scaffold user acctLocked:boolean familyId:integer
> isProfileSetup:boolean ...
> rails g model address user:references address:string city:string ...
>
>
> For more info:
> http://guides.rubyonrails.org/getting_started.html
> http://guides.rubyonrails.org/command_line.html#rails-generate
>
> One other small thing: you're writing your variable names using camel case
> (lowerCaseWithCapitalsIndicatingWordBoundaries) whereas the more widely
> recognized Ruby convention is to use all_lower_case_with_underscores.  I
> left your variable names as-is in the sample code above, but if it's code
> that anyone else will ever see or work on, you might consider changing it.
>
> On Fri, Jul 29, 2011 at 4:43 AM, Rick & Nellie Flower 
> wrote:
>
>> Ok.. Still working on this stuff.. I've got the t.reference in the
>> migration for the address class and moved the belongs_to and has_one in the
>> model classes as indicated (I didn't notice that!).
>>
>> I noticed in the association-basics that I should be putting a
>> create_table function (if that's what
>> it's called) in the CreateUsers class for Migrations but I'm concerned
>> about doing that since I'll be using the address class on more than just the
>> 'users' class -- does it really belong there or ??
>> Perhaps I'm overthinking this.. ??
>>
>> Below are the two class definitions for both the model & migration :
>>
>> class Address < ActiveRecord::Base
>>  belongs_to :user
>>  belongs_to :organization
>>  belongs_to :supplier
>> end
>>
>> class CreateAddresses < ActiveRecord::Migration
>>
>>  def self.up
>>create_table :addresses do |t|
>>  t.string :address
>>  t.string :city
>>  t.string :state
>>  t.string :zip
>>  t.string :email
>>  t.string :phone
>>   t.references : users
>>
>>  t.timestamps
>>end
>>  end
>>
>>  def self.down
>>drop_table :addresses
>>  end
>> end
>>
>> =
>> class User < ActiveRecord::Base
>>  enum_attr :accountType, %w(regular admin site_admin), :init=>:regular
>>
>>  has_one :name
>>  has_one :address
>>  has_one :organization
>>
>> end
>>
>> class CreateUsers < ActiveRecord::Migration
>>
>>  def self.up
>>create_table :users do |t|
>>   t.boolean  :acctLocked
>>  t.integer  :familyId
>>   t.boolean  :isProfileSetup
>>  t.datetime :lastLogin
>>  t.string   :password
>>  t.string   :securityQ
>>  t.string   :securityA
>>  t.string   :username
>>   t.enum :accountType
>>
>>  t.timestamps
>>end
>>
>>create_table :a
>>   end
>>
>>  def self.down
>>drop_table :users
>>  end
>> end
>>
>> --
>> You received this message because you are

Re: [Rails] RedCloth and sanitizing input

2011-07-28 Thread Chris Kottom
I've used this before and found it to be flexible enough.  It includes a
number of out-of-box configurations to enable removal of all or just some
tags or allows you to create your own.

https://github.com/rgrove/sanitize/

On Thu, Jul 28, 2011 at 11:52 PM, Jan Marquardt  wrote:

> Hi mates,
>
> I've hit a problem and hope for some advices.
>
> I am developing a blog for my family and I want to provide the opportuniy
> that everyone may format his blog posts. After some research I found
> RedCloth. It seems that it does exactly what I want, but for output i need
> to use the raw helper.
>
> <%= raw RedCloth.new(post.content) %>
>
> But this also allows them to use HTML in their posts. What is the best
> practice to prevent the usage of HTML and sanitize the content in this case?
> Is there any plugin for achiving this?
>
> I'd be thankful for any help.
>
> Kind regards,
>
> Jan
>
> --
> 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+unsubscribe@**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-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.



Re: [Rails] Question regarding associations..

2011-07-28 Thread Chris Kottom
Are you not using generators for the initial creation of your model and
migration source files?  I'm asking because I think I can count on one hand
the number of times I've ever written out a create_table function myself.
 Your inputs from the command line should do all this for you along with
some of the work of setting up your model associations (e.g. the belongs_to
call in your Address class definition) and save you some effort.  If you're
using the generators properly, you may never have to touch the migration
files for simpler applications.

rails g scaffold user acctLocked:boolean familyId:integer
isProfileSetup:boolean ...
rails g model address user:references address:string city:string ...


For more info:
http://guides.rubyonrails.org/getting_started.html
http://guides.rubyonrails.org/command_line.html#rails-generate

One other small thing: you're writing your variable names using camel case
(lowerCaseWithCapitalsIndicatingWordBoundaries) whereas the more widely
recognized Ruby convention is to use all_lower_case_with_underscores.  I
left your variable names as-is in the sample code above, but if it's code
that anyone else will ever see or work on, you might consider changing it.

On Fri, Jul 29, 2011 at 4:43 AM, Rick & Nellie Flower wrote:

> Ok.. Still working on this stuff.. I've got the t.reference in the
> migration for the address class and moved the belongs_to and has_one in the
> model classes as indicated (I didn't notice that!).
>
> I noticed in the association-basics that I should be putting a create_table
> function (if that's what
> it's called) in the CreateUsers class for Migrations but I'm concerned
> about doing that since I'll be using the address class on more than just the
> 'users' class -- does it really belong there or ??
> Perhaps I'm overthinking this.. ??
>
> Below are the two class definitions for both the model & migration :
>
> class Address < ActiveRecord::Base
>  belongs_to :user
>  belongs_to :organization
>  belongs_to :supplier
> end
>
> class CreateAddresses < ActiveRecord::Migration
>
>  def self.up
>create_table :addresses do |t|
>  t.string :address
>  t.string :city
>  t.string :state
>  t.string :zip
>  t.string :email
>  t.string :phone
>   t.references : users
>
>  t.timestamps
>end
>  end
>
>  def self.down
>drop_table :addresses
>  end
> end
>
> =
> class User < ActiveRecord::Base
>  enum_attr :accountType, %w(regular admin site_admin), :init=>:regular
>
>  has_one :name
>  has_one :address
>  has_one :organization
>
> end
>
> class CreateUsers < ActiveRecord::Migration
>
>  def self.up
>create_table :users do |t|
>   t.boolean  :acctLocked
>  t.integer  :familyId
>   t.boolean  :isProfileSetup
>  t.datetime :lastLogin
>  t.string   :password
>  t.string   :securityQ
>  t.string   :securityA
>  t.string   :username
>   t.enum :accountType
>
>  t.timestamps
>end
>
>create_table :a
>   end
>
>  def self.down
>drop_table :users
>  end
> end
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Question regarding associations..

2011-07-28 Thread Chris Kottom
You don't have a FK for user_id in your ADDRESSES table for starters, and
you didn't include your model files, so there's no way of knowing whether
you've defined the relationships there.

See:
http://guides.rubyonrails.org/migrations.html
http://guides.rubyonrails.org/association_basics.html

On Thu, Jul 28, 2011 at 8:53 AM, Rick & Nellie Flower wrote:

> Ok.. So I've got my initial table structures setup and I was hoping I could
> have associations help me out with something akin to embedded/nested objects
> but without the direct nesting (unless there's another way to achieve that
> goal)..
>
> So, I've got an Address class that looks like the following :
>
> class CreateAddresses < ActiveRecord::Migration
>  belongs_to :user
>
>  def self.up
>create_table :addresses do |t|
>  t.string :address
>  t.string :city
>  t.string :state
>  t.string :zip
>  t.string :email
>  t.string :phone
>
>  t.timestamps
>end
>  end
>
>  def self.down
>drop_table :addresses
>  end
> end
> 
> I've then got a user class that looks like the following :
>
> class CreateUsers < ActiveRecord::Migration
>  has_one :address
>
>  def self.up
>create_table :users do |t|
>  t.srting  :name
>  t.boolean  :isProfileSetup
>  t.datetime :lastLogin
>  t.string   :password
>  t.string   :securityQ
>  t.string   :securityA
>  t.string   :username
>
>  t.timestamps
>end
>  end
>
>  def self.down
>drop_table :users
>  end
> end
>
> I was hoping I could do something like the following in the rails console
> and have it work
> but it does not:
>
> => @user=User.create
> =>@city=@user.address.city
>
> Any ideas on whether I'm barking up the wrong tree with associations --
> perhaps using
> the wrong syntax or is it even possible with what I want to do?  I feel
> like they ought to work
> but…
>
> Any ideas?? 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.
>
>

-- 
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.



Re: [Rails] Re: Deploying RoR apps from different branches

2011-07-27 Thread Chris Kottom
I've not used SVN for some years now nor Vlad the Deployer ever, but I'm
using Capistrano / GitHub, and it is possible there using the Capistrano
multistage extension.  You simply define common parts of the configuration
in a common file and any varying configuration parts (including SCM branch,
in your case) in the environment-specific config file, and you're off and
running.

See: https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension

On Wed, Jul 27, 2011 at 10:09 AM, Nicolas Sebrecht wrote:

> The 26/07/11, BirdieTracker wrote:
> > I have a multi-environment configuration (local, staging, development)
> > in which I can deploy the same branch (ie...trunk) to with ease using
> > Vlad the Deployer.  I'm struggling to figure out how to deploy a new
> > branch to my staging environment, without having to check out the
> > entire repository (subversion) onto the staging server.
> >
> > Has anyone run into this problem and solved it?
> >
> > Am I complicating things for myself?  If so, what is a better way to
> > manage branches and deployments to various environments?
> >
> > Thanks!
> > Ron
> >
> > PS...I'm open to switching to a new deployment tool.
>
> I would try any DVCS.
>
> --
> Nicolas Sebrecht
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Re: Creating a Simple Orders System

2011-07-26 Thread Chris Kottom
The term you're looking for is LineItem, and it is typical to include things
like Peter suggests above -- snapshot information of any Product info that
would be necessary for printing invoices -- as well as tax calculations,
fulfillment status, return status, etc.  In this case, you would probably
want the following relationships:

Product has many LineItems / LineItem belongs to Product
Order has many LineItems / LineItem belongs to Order
Order has many Products through LineItems
Product has many Orders through LineItems

HTH...

On Tue, Jul 26, 2011 at 10:01 PM, Peter Bell  wrote:

> On Jul 26, 2011, at 3:58 PM, KlausG wrote:
>
> > I whonder why a product should have many orders? It belongs to
> > orders..
>
> Not being paying much attention to this thread, but whenever I see comments
> like this I'm cautious. Bear in mind that if products are mutable (can vary
> over time), typically you want to replicate some of their data as of a point
> in time so that a order has-many order_items which contain product
> information as at that point in time.
>
> Otherwise if you're not careful, updating the price on your products
> completely changes the value of all of your historic orders containing that
> product.
>
> Apologies if it's not relevant to the thread, but if it is, it's something
> that should be considered in the design.
>
> Best Wishes,
> Peter
>
> >
> >>> class Customer < ActiveRecord::Base
> >>>has_many :orders
> >>> end
> >>> class Order < ActiveRecord::Base
> >>>belongs_to :customer
> >>>has_many :products
> >>> end
> >>> class Product < ActiveRecord::Base
> >>>belongs_to :orders
> >>> end
> >
> > --
> > 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.
> >
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Beginners Problem

2011-07-25 Thread Chris Kottom
Have you googled it yet?  Have you seen
http://stackoverflow.com/questions/5840742/version-of-mysql2-0-3-2-doesnt-ship-with-the-activerecord-adapter-bundled-anym
?

What does your Gemfile look like?


On Mon, Jul 25, 2011 at 5:26 PM, Robert B.  wrote:

> Hi Everyone,
>
> Heres the problem whenever I startup webrick server and goto
> 0.0.0.0:3000 (When I start the server in my terminal it says this
>
> "Booting WEBrick => Rails 3.0.9 application starting in development on
> http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown
> server [2011-07-19 11:17:11] INFO  WEBrick 1.3.1 [2011-07-19 11:17:11]
> INFO  ruby 1.8.7 (2009-06-12) [universal- darwin10.0] [2011-07-19
> 11:17:11] INFO  WEBrick::HTTPServer#start: pid=325 port=3000 "
>
> in the browser my rails project comes up and when I click on "About
> your application’s environment" it says
> "Please install the mysql2 adapter: `gem install activerecord-mysql2-
> adapter` (no such file to load -- active_record/connection_adapters/
> mysql2_adapter)"
> and i have tried this and researched it for many hours!
>
> EXTRA INFORMATION:
> when i end the webrick server this is what is said
>
> "DEPRECATION WARNING: config.action_view.debug_rjs will be removed in
> 3.1, from 3.1 onwards you will need to install prototype-rails to
> continue to use RJS templates . (called from /Library/Ruby/Gems/1.8/
> gems/railties-3.0.9/lib/rails/engine.rb:192)
> Started GET "/rails/info/properties" for 127.0.0.1 at Tue Jul 19
> 11:18:43 +0200 2011
> RuntimeError (Please install the mysql2 adapter: `gem install
> activerecord-mysql2-adapter` (no such file to load -- active_record/
> connection_adapters/mysql2_adapter)):
> Rendered /Users/robertbodley/.gem/ruby/1.8/gems/actionpack-3.0.9/lib/
> action_dispatch/middleware/templates/rescues/_trace.erb (0.6ms)
> Rendered /Users/robertbodley/.gem/ruby/1.8/gems/actionpack-3.0.9/lib/
> action_dispatch/middleware/templates/rescues/_request_and_response.erb
> (15.7ms) Rendered
> /Users/robertbodley/.gem/ruby/1.8/gems/actionpack-3.0.9/lib/
> action_dispatch/middleware/templates/rescues/diagnostics.erb within
> rescues/layout (19.5ms) ^C[2011-07-19 11:20:58] INFO  going to
> shutdown ... [2011-07-19 11:20:58] INFO  WEBrick::HTTPServer#start
> done. Exiting"
> my gem list is:
> "gem list
>
>
> *** LOCAL GEMS ***
> abstract (1.0.0)
> actionmailer (3.0.9)
> actionpack (3.0.9)
> activemodel (3.0.9)
> activerecord (3.0.9 ruby)
> activerecord-jdbc-adapter (1.1.2)
> activerecord-jdbcmysql-adapter (1.1.2)
> activeresource (3.0.9)
> activesupport (3.0.9)
> arel (2.1.3, 2.0.10)
> builder (3.0.0, 2.1.2)
> bundler (1.0.15)
> erubis (2.6.6) i18n (0.5.0)
> jdbc-mysql (5.1.13)
> mail (2.2.19)
> mime-types (1.16)
> mysql (2.8.1)
> mysql2 (0.3.6, 0.2.11)
> polyglot (0.3.1)
> rack (1.2.3)
> rack-mount (0.6.14)
> rack-test (0.5.7)
> rails (3.0.9)
> railties (3.0.9)
> rake (0.9.2)
> rdoc (3.8, 3.7, 3.6.1)
> rubygems-update (1.8.5)
> sqlite3 (1.3.3)
> thor (0.14.6)
> treetop (1.4.9)
> tzinfo (0.3.29, 0.3.28)"
>
> I am using "mysql2"
>
> if you would need anymore information. Please would you ask
>
> Thank you
> Robert
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] complex form problem

2011-07-22 Thread Chris Kottom
You didn't include any source code, and without that, no one is going to be
able to tell you for sure what you're doing wrong.  The output here
indicates that the @project reference isn't being initialized.  Is there
actually a call like @project = Project.new(...) in the action method?

If this turns out not to be the problem, please include at least the full
ProjectsController#new source when you respond.

On Fri, Jul 22, 2011 at 6:38 AM, Angelo Cordova  wrote:

> I tried to make this work
>
> http://guides.rubyonrails.org/form_helpers.html#building-complex-forms
>
> the example of
>
> Handle Multiple Models in One Form from Advanced Rails Recipes
>
> but, when I want to create a new project I get this error:
>
> NoMethodError in ProyectsController#new
>
> --
> undefined method `tasks' for nil:NilClass
>
> Rails.root: /home/angelo/prueba
> Application Trace | Framework Trace | Full Trace
>
> app/controllers/projects_controller.rb:28:in `new'
>
> Request
>
> Parameters:
>
> None
>
> Show session dump
>
> Show env dump
> Response
>
> Headers:
>
> None
>
> --
>
> btw the line 28 in project controller is
>
> @project.tasks.build
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] HAML partial IF/ELSE, how can I DRY this up?

2011-07-19 Thread Chris Kottom
Try content_for maybe?  Usually it's used for passing snippets up the
template chain, but it would probably work in this case as well.

- content_for(:not_dry) do
%span this is not DRY
- if defined?(skipLI) && skipLI
- yield :not_dry
- else
  %li
- yield :not_dry

On Tue, Jul 19, 2011 at 6:54 PM, Chris Braddock wrote:

> Can I do it without resorting to making another partial to contain the
> %span content below?
>
> # partial begin
> - if defined(skipLI) && skipLI
>   %span this is not DRY
> - else
>   %li
> %span this is not DRY
> # partial end
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/LIoHBKXXDxIJ.
> 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.
>

-- 
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.



Re: [Rails] Basic Setup and Architecture...

2011-07-19 Thread Chris Kottom
Try searching for "rails template" on GitHub, and you'll get a lot of
answers from smart people on the gems question.  Any questions of
architecture though above and beyond the standard Rails folder structure are
going to be specific to each application though.

On Tue, Jul 19, 2011 at 11:55 AM, Manoj Sachwani
wrote:

> Just wondering,
>
> What are the basic gems that you guys use and the architecture (code
> base and otherwise) do you guys follow when starting a new Rails
> project?
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] (jQuery) Accordion and Rails (3.0.9): architectural doubt

2011-06-30 Thread Chris Kottom
This isn't strictly a Rails question, but all the content sections in this
component are just elements of the same HTML document, so that suggests one
controller action / view template.

On Thu, Jun 30, 2011 at 1:13 PM, JB  wrote:

> Hi!
> I'm trying to use jQuery's Accordion (http://jqueryui.com/demos/
> accordion/) in the home page of an app.
>
> One (maybe two...) doubt is bugging me, though...
>
> Do I have to have only one view/controller, holding the actions for
> all the accordion's sections? What if (at least) one of those sections
> have tabs, is it still one view/controller?
>
> Thanks in advance,
>
> José Bonnet
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Stange problem with Routes

2011-06-28 Thread Chris Kottom
You need to post snippets of your view and controller code in order to get a
full assessment, but if I were trying to diagnose this on my own
application, I'd initially look for an HTTP verb mismatch. Are you sure that
the attempted destroy request is calling :method => :delete ?

On Tue, Jun 28, 2011 at 9:12 PM, Fernando Aureliano <
m...@fernandoaureliano.com> wrote:

> Thanks, I did,
>
> now, he go to the post item, without delet it
>
> Oo
>
>
> On Tue, Jun 28, 2011 at 3:53 PM, thiagocifani wrote:
>
>> Hello dude, I have had the same error once! But my problem was a conflict
>> between jquery and prototype!
>>
>> I solved that problem just deleting any prototype file and installing
>> jquery gem!
>>
>> Hope it work for you too!
>>
>>
>> best regards
>>
>> On Tue, Jun 28, 2011 at 3:46 PM, Fernando Aureliano <
>> m...@fernandoaureliano.com> wrote:
>>
>>> I make a CRUD with Routes:
>>>
>>> *resources :movies*
>>>
>>> so, the destroy action stopped working:
>>>
>>>
>>> No route matches "/movies/3"
>>>
>>> so I did
>>>
>>> *match 'videos/:id' => 'videos#destroy'*
>>>
>>>
>>> then I get:
>>>
>>>
>>> Couldn't find Movie with ID=new
>>>
>>>
>>> then I do
>>>
>>> *match 'movies/:id' => 'movies#destroy'*
>>> *match "movies/new" => "movies#new"*
>>> *match "movies/:id/edit" => "movies#edit"*
>>> *match "movies" => "movies#index"*
>>>
>>> And I get the same problem
>>>
>>> Then I try:
>>>
>>> *resources : movies, :only => [:index, :edit, :new, :create, :destroy]*
>>>
>>> And get the same thing 
>>>
>>>
>>> Someone know why?
>>>
>>>
>>> Thanks!
>>>
>>>
>>> --
>>> *Fernando Aureliano*
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>> thiagocifani
>> http://thiagocifani.wordpress.com/
>> twitter.com/thiagocifani
>> del.icio.us/thiagocifani
>> 
>>
>>
>>  --
>> 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.
>>
>
>
>
> --
> *Fernando Aureliano*
>
>
>  --
> 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.
>

-- 
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.



Re: [Rails] Re: serving only controller+action specific css/javascript

2011-06-28 Thread Chris Kottom
No, in the solution I suggested the decision about which assets to use is
made in the template and can't depend on the controller name/action.
 There's no way that I know of to determine the template name in the same
way via a helper function.

The only other option that might be useful for you would be to have combined
CSS/JS files for some actions where this type of thing can occur like with
update/edit and set the ID or class of the  tag based on the template
rendered.  You could then target selectors in your assets to ensure the
correct behavior, but this might end up being more effort than a simpler
solution.

On Tue, Jun 28, 2011 at 4:52 PM, Chris Braddock wrote:

> Hmm, maybe I'm confused.  Even if I used your solution verbatim I think I'm
> still stuck with the problem as update.html.erb would not be used
> (edit.html.erb would).
>
> To recap, what you're suggesting is essentially what I'm doing -- except
> instead of hard-coding "people/update" I'm using a helper method that uses
> controller.controller_name + "/" + controller.action_name to generate that
> part of the path.
>
> So far so good, but when I use "render :edit" in the "update" action, I've
> got my problem (I'm requesting the wrong action's assets).
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/2LGOmrUizjYJ.
>
> 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.
>

-- 
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.



Re: [Rails] Re: serving only controller+action specific css/javascript

2011-06-28 Thread Chris Kottom
Sounds like a job for content_for.  You need a snippet like this in your
view template:

update.html.erb:
<% content_for :assets do %>
<%= stylesheet_link_tag "people/update" %>
<%= javascript_include_tag "people/update" %>
<% end %>

And in your layout:
...
<%= yield :assets $>
...


On Tue, Jun 28, 2011 at 3:40 PM, Chris Braddock wrote:

> Well, I see I can do this, but it seems like a pretty bad idea.
>
>   def *update*
> if @something_goes_wrong
>   *self.acion_name = 'edit'*
>   render *:edit*
> end
>   end
>
> Anyone?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/T7kUgXIxSscJ.
>
> 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.
>

-- 
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.



Re: [Rails] Dateformat: x minutes ago

2011-06-20 Thread Chris Kottom
I don't know of a good gem solution (though it would be great if there were
one because this is a problem that has been solved and re-solved too many
times) but DHH did a blog post a few years back that explains exactly how to
implement this in a relatively simple way.

http://37signals.com/svn/posts/1557-javascript-makes-relative-times-compatible-with-caching

On Tue, Jun 21, 2011 at 7:55 AM, Martin Wawrusch wrote:

> Hi guys,
>
> Is there a standard function/gem in rails that lets me format times in a
> facebookish way, like "x minutes ago"? Ideally one that works well together
> with a similar jquery library for live updates?
>
> Thanks
> Martin
>
> --
> 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.
>

-- 
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.



Re: [Rails] Error of undefined method

2011-06-20 Thread Chris Kottom
You don't have an <% end %> to close the <% @users.each %> block in the code
you included, so my guess is that your u variable is already out of scope by
the time you call u.image.

On Mon, Jun 20, 2011 at 9:08 PM, joanne ta  wrote:

> the error is undefined method `image' for nil:NilClass
>
>
> On Mon, Jun 20, 2011 at 2:42 PM, Colin Law  wrote:
>
>> On 20 June 2011 17:53, joanne ta  wrote:
>> > I have other undefined method when i combine the code above together
>> >
>> > <%@users = User.all%>
>> > <%@users.each do |u|%>
>> > <%u.culture_id%>
>> >
>> >  <% @pic= Picture.where(:phrase_id => :route , :culture_id =>
>> > u.culture_id).first%>
>> > My picture <%= @pic.image%>
>> >
>> > and it causes undefined method image
>>
>> What does it say has not got a method image?  It is always a good idea
>> to post the complete error message (use copy/paste rather than
>> re-typing it).  If it says the nil has not got the method then your
>> call of Picture.where has not found a record.
>>
>> 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.
>

-- 
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.



Re: [Rails] How to make a word act as a button?

2011-06-06 Thread Chris Kottom
Rails provides a helper method for doing just that:
http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptHelper.html#method-i-link_to_function.
 You'll still need to write the JavaScript to fetch and display the photo
though.

On Tue, Jun 7, 2011 at 6:42 AM, Adam Stegman  wrote:

> On Jun 6, 2011, at 2:46 PM, Rodrigo Ruiz wrote:
>
> Hi, I'd like to know how can I make a link to a method. I mean, not a link
> that would normally render a new page, but something that looks like a link
> (a blue word) but triggers one of my class methods like show a photo at the
> right side of my website or hide it if clicked again.
>
> Thank you
>
>
> For this you would normally use JavaScript. I'd recommend reading up at
> Mozilla Developer Network: https://developer.mozilla.org/en-US/learn.
>
> Basically you'll register an 'onclick' handler on the link and in that
> function, change the display style of the photo. For instance:
>
> HTML:
> > 
> > ...
> > Show Picture
> > ...
> > 
>
> JavaScript (index.js):
> var link = document.getElementById("show-link");
> if (link) {
>   link.onclick = function(event) {
> var picture = document.getElementById("my-picture");
> if (picture) {
>   if (picture.style.display == "none") {
> picture.style.display = "inline";
>   } else {
> picture.style.display = "none";
>   }
> }
>   };
> }
>
> --
> 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.
>

-- 
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.



Re: [Rails] Devise

2011-06-06 Thread Chris Kottom
Hi Fernando,

I think this is the wiki page you're looking for:
https://github.com/plataformatec/devise/wiki/How-to:-redirect-to-a-specific-page-on-successful-sign-in
.

On Tue, Jun 7, 2011 at 4:33 AM, Fernando Aureliano <
m...@fernandoaureliano.com> wrote:

> Hi!!
>
> Thanks by the tip!
>
> I already read this wiki, is pretty good! But he did not say how to change
> the route who redirect the user after he has login.
>
> I'm join the group to try this response!
>
> Thanks!!
>
>
> On Mon, Jun 6, 2011 at 11:01 PM, William K. Hatch Jr. <
> stompinwi...@gmail.com> wrote:
>
>> Hi Fernando, check this link:
>>
>>
>> https://github.com/plataformatec/devise/wiki/How-To:-Change-the-default-sign_in-and-sign_out-routes
>>
>> Devise has a pretty good user group on google, too. Jose is usually pretty
>> responsive with any question. HTH
>>
>> Bill
>>
>>
>> On Jun 6, 2011, at 9:07 PM, Fernando Aureliano wrote:
>>
>> > Hi, I'm working with devise for user system, but after logged in, he
>> redirect the user for the root project. I would like to redirect each type
>> of user for an different page. Someone already did something like that with
>> devise?
>> >
>> > Thanks!
>> >
>> > --
>> > Fernando Aureliano
>> >
>> > --
>> > 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.
>>
>> --
>> 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.
>>
>>
>
>
> --
> *Fernando Aureliano*
> --
> [iOSDeveloper] - *ObjectiveC*
> [WebDesigner] - *CSS3&HTML5*
> *[WebDeveloper] - RubyOnRails*
> *--
> *
> [portfolio]  - 
> [blog]
>  - [personal blog]  - 
> [twitter]
>
>  --
> 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.
>

-- 
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.



Re: [Rails] Rails or php?(appreciate all opinions)

2011-06-06 Thread Chris Kottom
Neither PHP or Ruby is a CMS on its own, but if you're considering one, a
lot of people on this list would state a preference for Ruby.  If you're
thinking about customizing an existing CMS system or framework, I think the
most mature options are probably those that have been developed in PHP,
though that could be a subject for some debate.  Ultimately though, you
should choose the tool that gives you the best leverage over the set of
problems you face in your work.

On Sun, Jun 5, 2011 at 6:20 PM, Blackflow wrote:

> Hi, I have a small webdesign company and got to a point where I have a
> small self made php based cms. I never liked php and that's why i
> started looking for something different. I 've started to learn a
> little ruby and rails so i have some idea how it all looks like. My
> question in basically whether to use php or ruby for my further
> developing, and when with ruby shall i try making something of my own
> or rather learn to use rafinery or radiant. Now I'm making simple  and
> moderately complicate websites with a bit of jquery and flash.
> Eventually I want to have a cms to use for simple sites but flexible
> enough to make something more complicated with some extra coding...
> I'll appreciate all your opinions.
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Built in (boolean)? method

2011-06-05 Thread Chris Kottom
Sorry, I misunderstood the original message.  Ran similar tests in my local
environment with same Ruby / Rails, and wasn't able to get a similar
outcome.  Is there anything in your model that could be overriding the
dynamically created accessor?

On Sun, Jun 5, 2011 at 9:55 AM, Ants Pants wrote:

> i know about the storage issue (or at least I thought I did) but what I am
> saying is that the returned values are different between the attribute
> for_charity and for_charity?
>
> Surely that has nothing to do with how the values are stored? I sent the
> output form console in my original email to show that.
>
> -ants
>
>
> On 4 June 2011 09:13, Chris Kottom  wrote:
>
>> The actual representation of any attribute type in Rails will depend on
>> the underlying DBMS as the mapping changes from platform to platform.  But
>> if we assume we're talking about SQLite as an example, it uses a SQLite
>> boolean which is actually stored as 0 for FALSE or 1 for TRUE, and both of
>> these are considered "trueish" values by Ruby.
>>
>> On Sat, Jun 4, 2011 at 8:47 AM, Ants Pants wrote:
>>
>>> When creating a boolean attribute in ActiveRecord, you get a ? method for
>>> free. Sadly, it's returning false for a true value. Does anyone know what
>>> might be going on?
>>>
>>> From my console (for_charity: true). Same behaviour on Rails 2.3.8 and
>>> 2.3.11
>>>
>>> ruby-1.8.7-p302 > m.for_charity?
>>>  => false
>>> ruby-1.8.7-p302 > m.for_charity
>>>  => true
>>> ruby-1.8.7-p302 >
>>>
>>> Thx in advance
>>>
>>> -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-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.
>>>
>>
>>  --
>> 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.
>>
>
>  --
> 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.
>

-- 
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.



Re: [Rails] Built in (boolean)? method

2011-06-04 Thread Chris Kottom
The actual representation of any attribute type in Rails will depend on the
underlying DBMS as the mapping changes from platform to platform.  But if we
assume we're talking about SQLite as an example, it uses a SQLite boolean
which is actually stored as 0 for FALSE or 1 for TRUE, and both of these are
considered "trueish" values by Ruby.

On Sat, Jun 4, 2011 at 8:47 AM, Ants Pants wrote:

> When creating a boolean attribute in ActiveRecord, you get a ? method for
> free. Sadly, it's returning false for a true value. Does anyone know what
> might be going on?
>
> From my console (for_charity: true). Same behaviour on Rails 2.3.8 and
> 2.3.11
>
> ruby-1.8.7-p302 > m.for_charity?
>  => false
> ruby-1.8.7-p302 > m.for_charity
>  => true
> ruby-1.8.7-p302 >
>
> Thx in advance
>
> -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-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.
>

-- 
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.



Re: [Rails] Re: Different user sessions with different domain name?

2011-06-02 Thread Chris Kottom
Yes, important point there.  The choice to host across multiple subdomains
should be made for a reason, not by default.  If the subdomain is an
essential part of the user's request (Google up "Basecamp style subdomains"
if you're not sure what I mean by this) then it's possible that you'd want
separate cookies for each subdomain.  In the vast majority of cases however,
the application isn't inferring anything from the subdomain, and you're
potentially losing PageRank.

Making the configuration at the web server will help you with both problems,
if it is in fact a problem to have more than one subdomain, whereas the
Rails-only solution helps only with cookie management.


On Thu, Jun 2, 2011 at 9:53 AM, ratnadeepdeshm...@gmail.com <
ratnadeepdeshm...@gmail.com> wrote:

> But overall redirection from non www to www or vice versa should be done at
> least for "www" subdomain.. As google bot considers www and non www as two
> different sites.
>
> So go with Apache configs way if you want www and non www to be same.
>
> And go with Rails cookies way, if you really have some subdomains like
> app1.example.com and app2.example.com, where app1 and app2 are sharing the
> session.
>
>
> On Thu, Jun 2, 2011 at 9:18 AM, jiblethead  wrote:
>
>> > in config/initializers/session_store.rb
>> >
>> > MyApp::Application.config.session_store :cookie_store, :key =>
>> > '_my_app_session', :domain => 'xxx.com'
>> >
>>
>> the solution I've found to work consistently is to modify as above,
>> but set :domain => '.xxx.com'
>>
>> Having the leading period (.) will set a common cookie that is shared
>> by all subdomains.  I use this technique to handle a secure subdomain
>> vs. a www subdomain, without creating new sessions between the two.
>>
>> Kevin
>>
>> --
>> 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.
>>
>>
>
>
> --
> Ratnadeep Deshmane.
> http://rtdptech.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.
>

-- 
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.



Re: [Rails] Different user sessions with different domain name?

2011-06-01 Thread Chris Kottom
OK, it's got *something* to do with Rails.  :)

Thanks for the dose of knowledge, Jim.

On Wed, Jun 1, 2011 at 1:10 PM, Jim Ruther Nill  wrote:

>
>
> On Wed, Jun 1, 2011 at 6:42 PM, tashfeen.ekram 
> wrote:
>
>> i noticed if you access my site with xxx.com versus www.xxx.com
>> separate user sessions are created such that same visitor form the
>> same browser can log in twice. I am not sure if this perhaps is a DNS
>> issue or this can be dealt at the level of rails app.
>>
>>
> in config/initializers/session_store.rb
>
> MyApp::Application.config.session_store :cookie_store, :key =>
> '_my_app_session', :domain => 'xxx.com'
>
> so any subdomain will still use the session for xxx.com
>
>
>
>> 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.
>>
>>
>
>
> --
> -
> visit my blog at http://jimlabs.heroku.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.
>

-- 
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.



Re: [Rails] Different user sessions with different domain name?

2011-06-01 Thread Chris Kottom
Cookies are scoped according to a domain name and path, so if you're using
two different host names, you're going to get two different cookies.

I would fix this on the level of your web server as it's got nothing to do
with Rails really.  This page on the Apache wiki will give you an idea of
what you need to do, but the solution will depend on which HTTP server you
use.

http://wiki.apache.org/httpd/CanonicalHostNames

On Wed, Jun 1, 2011 at 12:42 PM, tashfeen.ekram wrote:

> i noticed if you access my site with xxx.com versus www.xxx.com
> separate user sessions are created such that same visitor form the
> same browser can log in twice. I am not sure if this perhaps is a DNS
> issue or this can be dealt at the level of rails app.
>
> 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.
>
>

-- 
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.



Re: [Rails] Re: Two buttons respond to same action

2011-05-29 Thread Chris Kottom
This should be everyone's starting point when first learning about Rails
routing: http://guides.rubyonrails.org/routing.html

Read it a couple of times at least.  If you're still unsure, at least you'll
have enough context to come back and ask specific questions about the parts
you don't understand.

On Sun, May 29, 2011 at 10:01 AM, Stefano  wrote:

> I think I can speak for most people (yeah notice the most, didnt want
> to speak for everybody) here in saying, no we cant.
>
> On May 29, 6:51 am, amritpal pathak  wrote:
> > On Sat, May 28, 2011 at 12:30 PM, Frederick Cheung <
> >
> >
> >
> >
> >
> > frederick.che...@gmail.com> wrote:
> >
> > > On May 28, 3:06 pm, amritpal pathak  wrote:
> > > > Hey
> > > >   I am using rails 3.0.7.I created two buttons simply as:
> > > >  <%= button_to "Great", :action => "click"%>
> > > >  <%= button_to "click me", :action => "work"%>
> >
> > > > Router.rb file looks like:
> >
> > > > Check::Application.routes.draw do
> > > >  # get "gne/clg"
> >
> > > >   get "posts/index"
> > > >   resources :posts do
> > > >end
> > > > #get 'posts/click'
> >
> > > > ActionController::Routing::Routes.draw do |map|
> > > > map.root :controller => "posts", :action => "click"
> > > > end
> >
> > > > ActionController::Routing::Routes.draw do |map|
> > > > map.root :controller => "posts", :action => "work"
> > > > end
> > > >  end
> >
> > > First off you don't need that ActionController::Routing::Routes.draw
> > > stuff if you use the rails 3 syntax.
> > > root :to => "posts#click"
> >
> >  Thanks for help.It worked.
> >
> >
> >
> > > Secondly you're mapping both your actions to the same path - you need
> > > to map them to different paths if you want rails to know which action
> > > to route to when the request arrives.
> >
> >  Can you tell please how to map both actions to different paths.I
> >  am new to rails so dont know OR any good tutorial that can 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.
>
>

-- 
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.



Re: [Rails] Routing Error

2011-05-28 Thread Chris Kottom
Head is spinning from trying to keep up with the various threads and email
aliases that seem to be trying to solve the same problem.

>From what I see, you've got a mess in your routes file.  According to the
code you posted to this thread, you've got a resource defined plus two
non-resourceful routes, one of which seems to be trying to overlap with your
resource and one of which should be defined as an additional resourceful
route on the resource.

Now you have:

get "posts/index"
resources :posts do
end
get 'posts/click'


I think you're probably trying to get to this:

resources :posts do
  get 'click', :on => :member
end


I don't know what the click action is supposed to be doing, but you may need
to replace :member with :collection if the method acts on all posts instead
of a single one.

If that doesn't help, you're going to need to be more specific and attach
log snippet and output from rake routes.


On Sat, May 28, 2011 at 2:50 PM, john shelfer wrote:

>
>
> On Sat, May 28, 2011 at 7:25 AM, Chris Kottom wrote:
>
>> By default, the HTTP verb for button_to is POST.  If you really want to
>> make the request as a GET, you need to do it as:
>>
>> button_to "New", :action => "click", :method => :get
>>
>>
>>  Well.I did it but failed.Same error persists.
>> <%= button_to "New", :action => "click",:method => :get %>
>>
>>  John
>>
>>
>  --
> 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.
>

-- 
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.



Re: [Rails] Routing Error

2011-05-28 Thread Chris Kottom
By default, the HTTP verb for button_to is POST.  If you really want to make
the request as a GET, you need to do it as:

button_to "New", :action => "click", :method => :get


On Sat, May 28, 2011 at 12:24 PM, John  wrote:

> I made a button using "<%= button_to "New", :action => "click" %>" and have
> a method in controller as:
>  def click
>  end
> In app/view/posts/click.html.erb file holds simple
> hello message.In router.rb ,i added a route to click action of controller
> as but error is there when i click the button it gives the routing error.
>
> No route matches "/posts/click"
> Router.rb file looks like:
> Check::Application.routes.draw do
>   get "posts/index"
>  resources :posts do
>
>  end
> get 'posts/click'
>
>   # The priority is based upon order of creation:
>   # first created -> highest priority.
>
>   # Sample of regular route:
>   #   match 'products/:id' => 'catalog#view'
>   # Keep in mind you can assign values other than :controller and :action
>
>   # Sample of named route:
>   #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
>   # This route can be invoked with purchase_url(:id => product.id)
>
>   # Sample resource route (maps HTTP verbs to controller actions
> automatically):
>   #   resources :products
>
>   # Sample resource rwith_user/:uoute with options:
>   #   resources :products do
>   # member do
>   #   get 'short'
>#   post 'toggle'
>   # end
>   #
>   # collection do
>   #   get 'sold'
>   # end
>   #   end
>
>   # Sample resource route with sub-resources:
>   #   resources :products do
>   # resources :comments, :sales
>   # resource :seller
>   #   end
>
>   # Sample resource rwith_user/:uoute with more complex sub-resources
>   #   resources :products do
>   # resources :comments
>   # resources :sales do
>   #   get 'recent', :on => :collection
>   # end
>   #   end
>
>   # Sample resource route within a namespace:
>   #   namespace :admin do
>   # # Directs /admin/products/* to Admin::ProductsController
>   # # (app/controllers/admin/products_controller.rb)
>   # resources :products
>   #   end
>
>   # You can have the root of your site routed with "root"
>   # just remember to delete public/index.html.
>   # root :to => "welcome#index"
>
>   # See how all your routes lay out with "rake routes"
>
>   # This is a legacy wild controller route that's not recommended for
> RESTful applications.
>   # Note: This route will make all actions in every controller accessible
> via GET requests.
>   # match ':controller(/:action(/:id(.:format)))'
> end
>
> John
>
>
>  No route matches {:controller=>"posts",
> :action=>"click"}.
>
> John
>
> --
> 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.
>

-- 
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.



Re: [Rails] How to generate a form in rails 2.3.5

2011-04-18 Thread Chris Kottom
Have you read http://guides.rubyonrails.org/v2.3.8/form_helpers.html?

On Mon, Apr 18, 2011 at 11:55 AM, amrit pal pathak <
amritpalpath...@gmail.com> wrote:

> I am new to ROR and running 2.3.5.I want a simple form with some text
> boxes,password field,check box etc.
> How to generate a form in ROR?
>
> 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.
>
>

-- 
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.



Re: [Rails] Re: what is mean of Deployment?

2011-04-17 Thread Chris Kottom
Also by default if you'd created the app as a MySQL app in the first place:
  encoding: utf8
  reconnect: false
  socket: /var/run/mysqld/mysqld.sock

HTH.

On Sun, Apr 17, 2011 at 6:02 PM, Peter De Berdt
wrote:

>
> On 17 Apr 2011, at 17:04, amrit pal pathak wrote:
>
> On Apr 17, 7:27 am, Chris Kottom  wrote:
>
> Are you planning to continue using sqlite in the production environment?
>
>  Most people don't, but it's not a problem to do so.
>
>
> If not or if the default sqlite settings aren't right for you, then you'll
>
> need to make some changes, but those will depend on the environment you're
>
> deploying into.  But what those should be isn't a question the mailing list
>
> can answer for you without more information.
>
>
>   The production environment setting with sqllite are by
> default .I want to use mysql for production too.So i changed the
> production enviornment settings to
>   production:
>  adapter: mysql
>  database: blog
>  username: root
>  password: 12345
>  pool: 5
>  timeout: 5000
>
>   Is it enough??
>
>
> If you're running Rails 3, you're better off using "mysql2" as the adapter
> and you have to make sure you include the mysql2 gem in your Gemfile too.
> Also, you might want to use a more secure password for MySQL on your
> production server ;-)
>
>
> Best regards
>
>
> Peter De Berdt
>
>  --
> 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.
>

-- 
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.



Re: [Rails] Re: what is mean of Deployment?

2011-04-17 Thread Chris Kottom
Are you planning to continue using sqlite in the production environment?
 Most people don't, but it's not a problem to do so.

If not or if the default sqlite settings aren't right for you, then you'll
need to make some changes, but those will depend on the environment you're
deploying into.  But what those should be isn't a question the mailing list
can answer for you without more information.

On Sun, Apr 17, 2011 at 11:37 AM, amrit pal pathak <
amritpalpath...@gmail.com> wrote:

>
>
> On Apr 17, 4:06 am, Chris Kottom  wrote:
> > In a strict operational sense, the term means installation and
> > configuration/activation of software on any environment under management,
> so
> > it could be meant as production, staging, integration testing, etc.  In
> the
> > Rails world where development and testing are most often virtual
> > environments coexisting on the developer's workstation, this will only be
> > the production environment for most cases.
> I am running the application in development enviornment.I want
> to run it under now production one.So what changes i have to make in
> database.yml file
>
> The content of this file as are
>
>  # SQLite version 3.x
> #   gem install sqlite3-ruby (not necessary on OS X Leopard)
> development:
>  adapter: mysql
>  database: amritpal
>  username: root
>  password: 12345
>  pool: 5
>  timeout: 5000
>
> # Warning: The database defined as "test" will be erased and
> # re-generated from your development database when you run "rake".
> # Do not set this db to the same as development or production.
> test:
>  adapter: sqlite3
>  database: db/test.sqlite3
>  pool: 5
>  timeout: 5000
>
> production:
>  adapter: sqlite3
>  database: db/production.sqlite3
>  pool: 5
>  timeout: 5000
>
> 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.
>
>

-- 
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.



Re: [Rails] Re: what is mean of Deployment?

2011-04-17 Thread Chris Kottom
In a strict operational sense, the term means installation and
configuration/activation of software on any environment under management, so
it could be meant as production, staging, integration testing, etc.  In the
Rails world where development and testing are most often virtual
environments coexisting on the developer's workstation, this will only be
the production environment for most cases.

On Sun, Apr 17, 2011 at 9:48 AM, Colin Law  wrote:

> On 17 April 2011 07:08, amrit pal pathak 
> wrote:
> >
> >
> > On Apr 16, 11:40 am, Colin Law  wrote:
> >> On 16 April 2011 16:32, amritpal pathak 
> wrote:
> >>
> >> > what is meaning of deploy a ruby on rails application?i am new to RoR.
> >> > please somebody explain it
> >>
> >> Deployment is the process of putting the application on a production
> >> server for use by real users.
> >   Means enabling the production server from the database.yml file
>
> It is generally not only that as the machine that will be running the
> app in production is generally not the same one used for development.
> So deployment is the whole operation of getting it up and running on
> the production machine, which is often a public webserver rather than
> a desktop machine so the software environment is often significantly
> different.
>
> 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.
>
>

-- 
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.



Re: [Rails] No route matches "/home/index" with {:method=>:get}

2011-04-17 Thread Chris Kottom
Also verify that you are _actually_ using Rails 2.3.8.  Very basic check, I
know, but routing syntax is different in Rails 3, and I don't believe older
syntax is supported.

On Sun, Apr 17, 2011 at 8:59 AM, Jatin kumar wrote:

>
>
> On Sun, Apr 17, 2011 at 6:46 AM, amrit pal pathak <
> amritpalpath...@gmail.com> wrote:
>
>> I followed a tutorial to learn ruby on rails at
>> http://guides.rubyonrails.org/v2.3.8/getting_started.html
>> After creating a view and controller as  "script/generate controller
>> home index" and then i changed the contents of app/view/home/
>> index.html.erb file according to tutorial into one line as
>> Hello, Rails!
>>
>> Now i started the server as script/
>> server(successfully started) and when i navigate to localhost:3000/
>> home/index, i got a error message which says
>>
>> ROUTING ERROR
>> No route matches "/home/index" with {:method=>:get}
>>
>> Remove the /public/index.html file in your app directory.
> Check to see if you have a route for root in your routes.rb file.
> If not, make it
> *map.root :controller => "home"*
> If you still have problems, post the contents of your routes file.
>
>> Please someone help to resolve.
>>
>> 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.
>>
>>
>  --
> 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.
>

-- 
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.



Re: [Rails] Re: script/server (Error)

2011-04-14 Thread Chris Kottom
You need spaces between your YAML keys and values.  Example:

development:
  adapter: mysql
  database: blogg
  username: root
  password: 12345
  socket: /var/run/mysqld/mysqld.sock

On Thu, Apr 14, 2011 at 9:21 AM, amrit pal pathak  wrote:

>
>
> On Apr 14, 2:46 am, Chris Kottom  wrote:
> > Check your database.yml file.  In many cases, the problem can be due to
> > indentation, trailing whitespace, etc.
>
>  The content of database.yml file are as
>
>  # SQLite version 3.x
> #   gem install sqlite3-ruby (not necessary on OS X Leopard)
> development:
>   adapter:mysql
>  database:blogg
>  username:root
>  password:12345
>  socket:/var/run/mysqld/mysqld.sock
>
> # Warning: The database defined as "test" will be erased and
> # re-generated from your development database when you run "rake".
> # Do not set this db to the same as development or production.
> test:
>  adapter: sqlite3
>  database: db/test.sqlite3
>  pool: 5
>  timeout: 5000
>
> production:
>  adapter: sqlite3
>  database: db/production.sqlite3
>  pool: 5
>  timeout: 5000
>
>   in development environment ,seems no whitespaces.So what
> may be behind the error?
>
> 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.
>
>

-- 
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.



Re: [Rails] Re: script/server (Error)

2011-04-13 Thread Chris Kottom
Check your database.yml file.  In many cases, the problem can be due to
indentation, trailing whitespace, etc.

On Thu, Apr 14, 2011 at 8:00 AM, amrit pal pathak  wrote:

>
>
> On Apr 12, 1:06 pm, Chris Kottom  wrote:
> > Try: rake db:create
>  Tried it ,but it didnt help.Same error still exist
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] script/server (Error)

2011-04-12 Thread Chris Kottom
Try: rake db:create

On Tue, Apr 12, 2011 at 7:00 PM, amritpal pathak
wrote:

> i did
>  cd blog
>  script/server and got follwoing message .
>
>   => Booting WEBrick
> => Rails 2.3.8 application starting on http://0.0.0.0:3000
> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:62:in
> `establish_connection': adapter:mysql database:blogg username:root
> password:12345 socket:/var/run/mysqld/mysqld.sock database is not configured
> (ActiveRecord::AdapterNotSpecified)
>  from
> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in
> `establish_connection'
>  from
> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in
> `establish_connection'
>  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:438:in
> `initialize_database'
> from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:141:in
> `process'
>  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in
> `send'
> from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in
> `run'
>  from /home/amrit/blog/config/environment.rb:9
> from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
>  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `require'
> from
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in
> `require'
>  from
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in
> `new_constants_in'
> from
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in
> `require'
>  from /usr/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:84
> from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
>  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `require'
> from script/server:3
>
>
>
>  Then i did
>  lsof|grep 3000
>  kill -9 (4 digit ruby's code)
>  Still didnt help
>
> Please help to remove this
>
> 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.
>

-- 
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.



Re: [Rails] e-mail verification with rails 3

2011-04-12 Thread Chris Kottom
Devise implements this out of the box.  You need to implement the
:confirmable option on you migration and model, and you'll be all set.

On Tue, Apr 12, 2011 at 6:07 PM, Thomas Tomtom  wrote:

> Hello everyone
>
> Has anyone a suggestion about how to implement an email verification
> system with rails 3 ?
>
> By this I mean, a user subscribes (sign up) receives an email
> with a link and has to follow that link to change the status of the
> user, only after that the user can login.
>
> What's the best REST/rails way to do this ?
> Could I create more views then create/read/update/delete ?
> or is that bad ?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] Re: Testing a partial on its own

2011-04-12 Thread Chris Kottom
Hi David,

Regarding your outlook on functional testing, you're basically correct.  The
goal of these is to isolate the code contained in the controller layer, and
if you're following skinny-controller/fat-model best practice, these tests
will generally be pretty basic -- essentially, handle the setup and action
performed, and then check the variables set, the session and flash state
changes, the HTTP response, and the view rendered or redirect sent.

As far as your question about testing individual partials, I don't
personally do a ton of testing on the view level as such.  I _will_ scan my
views every so often to see if there's a bit of logic that would be a
candidate for testing and refactor those into helper methods wherever
possible.  But as far as I know, there's not really an easy way to test
individual partials outside the context of the templates that render them
because you'd need a controller method to prepare the state and trigger the
call to render them.

If this is something that interests you, I saw a library called Cells (
http://cells.rubyforge.org/) a few months back that creates something like a
miniature MVC stack for view fragments.  I believe it's possible to test
these independently, so you might want to check it out and see if there's
anything useful for you there.

On Tue, Apr 12, 2011 at 9:21 AM, David Paschich  wrote:

> Well, I'm going to break the rules and post a reply to my own message -
> mostly because nobody else has replied! Which makes me think that what I'm
> trying to do below isn't right.
>
> I've done a little poking around in projects written in rails I was able to
> find on github. I'm seeing a pattern where the functional tests focus on
> whether the controller invokes the right view and passes the right instance
> variables to that view - but not whether the view renders in any particular
> way.
>
> Is that the more rails-oriented way to go about things? And if so, why are
> assert_select and its relations so well developed?
>
> -David
>
>
> On Saturday, April 2, 2011 3:26:37 PM UTC-7, David Paschich wrote:
>>
>> Is it possible/feasible/advisable to test a partial view, on its own,
>> using
>> the default test mechanisms in Rails 3? I've been trying to figure out
>> how
>> to do this and not finding many good answers out there.  Maybe what
>> I'm
>> trying to do isn't "how it's done" in Rails, in which case please help
>> me
>> out. Below is a description of the problem, followed by some code to
>> illustrate what I'm talking about.
>>
>> One of the views in my project is composed of a number of smaller
>> tables -
>> just the sort of thing where you'd like to factor those tables out of
>> the
>> single view into a number of partials, especially since I'd like to
>> potentially re-use those smaller tables in other views.
>>
>> Right now, my functional test for the view has one long test method
>> with
>> sub-sections that test each partial. For two partials it's not bad;
>> but
>> eventually I'm going to have 7 or 8, and possibly let the user
>> customize
>> the page to show some but not others.
>>
>> I'd really rather have 3 test methods here: one which ensures that
>> the
>> parent page renders both partials, and then one for each partial. And
>> then
>> if I use those partials in other views, I only have to make sure that
>> the
>> partials are rendered - and maybe add some test cases for the partials
>> themselves.
>>
>> Below is the sample code, but so far the only definitive answer I've
>> been
>> able to find is "use Rspec". Is it really necessary to switch to a
>> whole
>> different testing framework just to do this? Or am I mis-using
>> functional
>> tests somehow?
>>
>> I pledge to turn the best answer into a diff on the testing
>> RailsGuide.
>>
>> Example code:
>>
>> I've got a parent view like:
>>
>> --
>> Some Preamble Stuff
>> <%= render(:partial => "teamlist", :object => @season) %>
>> <%= render(:partial => "racerlist", :object => @season) %>
>> Some Postamble Stuff
>> --
>>
>> Each of those partials is something like:
>>
>> --
>> 
>>  <% @season.teams.each do |team| %>
>>   <%= team.name %>
>>  <% end %>
>> 
>> --
>>
>> So how do I test that?  Right now, I have a functional test that looks
>> like:
>>
>> --
>> test "results page is correct" do
>>  get :results, :id => @season.id
>>  assert_response :success
>>
>>  assert_select "table#teamlist" do
>>   # make sure team list is right
>>  end
>>
>>  assert_select "table#racerlist" do
>>   # make sure racer list is right
>>  end
>> end
>> --
>>
>> But what I really want is:
>>
>> --
>> test "results page is correct" do
>>   get :results, :id = @season.id
>>   assert_response :success
>>   # assert the partials are rendered
>> end
>>
>> test "teamlist is correct" do
>>   get :teamlist #or something
>>   asserts to make sure teamlist is correct
>> end
>>
>> test "racerlist is correct" do
>>   render racerlist
>>   asserts to make sure racerlist is correct
>> end
>> --
>>
>> Anyone?
>
>  --
> You rece

Re: [Rails] Can i upgrade a project from rails 1.2.3 to rails 3.0.5 ?

2011-04-06 Thread Chris Kottom
It can be done, and I know of people who have done similar upgrades, but it
will require a step-wise approach.

Refer to a similar thread from a few weeks ago and use the advise described
there.

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/6768a95e28a504a0/

On Wed, Apr 6, 2011 at 9:08 AM, nishant  wrote:

> hello,
> i have an application which is created in rails 1.2.3 and ruby 1.8.6
> and now i have to upgrade it to rails 3.0.5 and ruby 1.8.7 ? is it
> possible? and if yes how  ?? can you guys provide me with some kind of
> link or reference .
>
>
>
> Thanks
> Nishant
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Recording remote_ip that created a record in a nested form

2011-03-31 Thread Chris Kottom
When a user creates a new record, it should be through a request with the
nested form which is then handled by a controller somewhere in your
application where you will have access to the client's IP.  You would then
need to store that IP address as part of your model for later retrieval /
display.  Right?  Or am I not understanding your question?

On Thu, Mar 31, 2011 at 11:04 PM, baldmark  wrote:

> My application creates new records in a nested form.  I want to record
> the ip address that created the record (assuming it was created from
> the controller in this way).  How can I do this, given that
> request.remote_ip is not accessible in the model?
>
> Mark
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] habtm additional column

2011-03-30 Thread Chris Kottom
Using HABTM prevents you from using the additional column, but you can get
the desired effect by replacing HABTM on each side with something like:

class Foo
  has_many  :foo_bars, :join_table => "foo_bars"
  has_many  :bars, :through => :foo_bars
end

On Thu, Mar 31, 2011 at 2:34 AM, Bryan Crossland wrote:

> On Wed, Mar 30, 2011 at 7:24 PM, Jim Ruther Nill  wrote:
>
>> Hi!
>>
>> In one of my current projects, I have an habtm relationship between two
>> models.  To access the table
>> via console, I created the model for the join table.  so for example, I
>> have
>>
>> class Foo
>>   has_and_belongs_to_many :bars, :join_table => 'foo_bars'
>>
>> I created a FooBar class so I can actually access the records via AR.  My
>> question is this, is it fine to
>> add another column to this table?
>>
>
> If you are going to add another column to the FooBar table then you might
> as well change the associations of models Foo and Bar to has_many :foo_bar
> and then put belongs_to :foo belongs_to :bar in your model FooBar. The point
> of the has_and_belongs_to_many is to setup a join table for association that
> you don't plan on accessing through a model or need additional fields for.
>
> B.
>
> --
> 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.
>

-- 
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] Ruby interpreter / version for greenfield project

2011-03-30 Thread Chris Kottom
Hi all,

I wanted to ask the list about the current thinking on which of the many
interpreter and version options is currently favored for a brand new
project.  I've been using the most recent REE release for many recent
projects simply because a lot of gems and plugins hadn't yet been made 1.9
compliant, but I think this is probably not as big a problem as it used to
be.  So what would you use?

Wherever possible, please supply the arguments and factors that led to your
decision, and thanks for your inputs.

-- 
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.



Re: [Rails] Re: "Undefined Attribute Method"

2011-03-26 Thread Chris Kottom
That "class" attribute is probably your problem.

On Sat, Mar 26, 2011 at 6:56 PM, Mistral Contrastin
wrote:

>
> > I'd say that the most likely problem is that you've managed to define
> > a method (or have an attribute with a name) that clashes with a
> > standard ruby or activerecord method.
> > Do you have a method or column named class by any chance?
> >
> > Fred
>
> I have these:
>
>t.string   "name"
>t.string   "surname"
>t.string   "email"
>t.integer  "tc_id"
>t.datetime "birthday"
>t.integer  "cellphone"
>t.integer  "localphone"
>t.boolean  "gender"
>t.string   "school"
>t.string   "class"
>t.text "address"
>t.boolean  "accommodation"
>t.boolean  "scholarship"
>t.text "other"
>t.text "arrival"
>t.text "condition"
>t.text "reference"
>t.string   "parent_n"
>t.string   "parent_s"
>t.integer  "parent_p"
>t.string   "parent_e"
>t.string   "alt_name"
>t.integer  "alt_phone"
>t.boolean  "attendance"
>t.string   "which_event"
>t.boolean  "attendance_p"
>t.string   "which_camp"
>t.text "expectation"
>t.string   "source"
>t.boolean  "terms"
>t.datetime "created_at"
>t.datetime "updated_at"
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] What is the best Ruby on rails IDE ?

2011-03-26 Thread Chris Kottom
+1 for Colin's suggestion.  I'm able to move pretty fast now that my fingers
are used to the key combinations I use with Emacs and GNU Screen.

I did use NetBeans for a while when I was getting started, and I found the
support to be pretty solid.  Oracle is discontinuing direct support for Ruby
and Rails in the upcoming version and throwing it over to the community to
continue maintenance, so it remains to be seen whether this will remain a
viable option.

On Sat, Mar 26, 2011 at 2:55 PM, Colin Law  wrote:

> On 26 March 2011 13:45, hoboy Hoboy  wrote:
> > What is the best ide for ruby on rails ?, I use linux.
> > please forgive me if the question is elementary.
> > I am java/.Net developer I want to broaden my horizon.
>
> Many, though not all, will suggest that an IDE is not useful for Rails
> development.  Choose an editor with ruby support (I use jEdit, Komodo
> edit free has also been recommended) and use the console for running
> scripts.
>
> 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.
>
>

-- 
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.



Re: [Rails] Re: Email Program

2011-03-26 Thread Chris Kottom
Source code?

On Sat, Mar 26, 2011 at 11:06 AM, uday kiran wrote:

> OK
>
>   i write the program it shows message
>
>
>Time expired
>
>
> C:/Ruby187/lib/ruby/1.8/timeout.rb:64:in `rbuf_fill'
> C:/Ruby187/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
>
>
> C:/Ruby187/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
> C:/Ruby187/lib/ruby/1.8/net/protocol.rb:126:in `readline'
> C:/Ruby187/lib/ruby/1.8/net/smtp.rb:923:in `recv_response'
> C:/Ruby187/lib/ruby/1.8/net/smtp.rb:554:in `do_start'
>
>
> C:/Ruby187/lib/ruby/1.8/net/smtp.rb:933:in `critical'
> C:/Ruby187/lib/ruby/1.8/net/smtp.rb:554:in `do_start'
> C:/Ruby187/lib/ruby/1.8/net/smtp.rb:525:in `start'
> C:/Ruby187/lib/ruby/1.8/net/smtp.rb:463:in `start'
>
>
> C:/Ruby187/lib/ruby/gems/1.8/gems/actionmailer-2.1.0/lib/action_mailer/base.rb:627:in
>  `perform_delivery_smtp'
> C:/Ruby187/lib/ruby/gems/1.8/gems/actionmailer-2.1.0/lib/action_mailer/base.rb:508:in
>  `__send__'
>
>
> C:/Ruby187/lib/ruby/gems/1.8/gems/actionmailer-2.1.0/lib/action_mailer/base.rb:508:in
>  `deliver!'
> C:/Ruby187/lib/ruby/gems/1.8/gems/actionmailer-2.1.0/lib/action_mailer/base.rb:414:in
>  `deliver'
>
>
>
> Here deliver method fails pls give me the solution.
>
>
> On 26 March 2011 15:13, Frederick Cheung wrote:
>
>>
>>
>> On Mar 26, 6:39 am, uday kiran  wrote:
>> > hi
>> >
>> >  Iam udaykiran.Iam new to ror.
>> >
>> >can u send the email program using ror.please urgent
>> >
>>
>> Not entirely sure what the question is, but Rails apps can of course
>> send email using actionmailer (which supports several delivery methods
>> and can be extended to support others (eg amazon SES))
>>
>> Fred
>> > Thanks & regards
>> >
>> > udaykiran
>>
>> --
>> 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.
>>
>>
>  --
> 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.
>

-- 
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.



Re: [Rails] Re: has_many with :dependent => :destroy not destroying

2011-03-26 Thread Chris Kottom
And it works as advertised.  Thanks a lot, Fred.

On Sat, Mar 26, 2011 at 12:51 PM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
> On Mar 26, 10:29 am, Chris Kottom  wrote:
> > I have three models: Book, User, and BookOwnership.  Book and User form
> an
> > m--to-n relationship, but because I will have additional information
> about
> > the ownership relationships, I cannot use has_and_belongs_to_many, so
> I've
> > defined the relationships as follows:
> >
> > class Book < ActiveRecord::Base
> >   has_many  :book_ownerships, :dependent => :destroy
> >   has_many  :owners, :through => :book_ownerships, :class_name => "User"
> > end
> >
> > class User < ActiveRecord::Base
> >   has_many  :book_ownerships, :dependent => :destroy
> >   has_many  :books, :through => :book_ownerships
> > end
> >
> > class BookOwnership < ActiveRecord::Base
> >   belongs_to  :book
> >   belongs_to  :owner, :class_name => "User"
> > end
> >
> > Based on this, I expect that when I call #destroy on an instance of
> either
> > Book or User it should also destroy the associated BookOwnership
> instances.
> >  But this doesn't seem to be happening.  Both of the tests below are
> > currently failing as are similar attempts in console.
> >
> > class BookOwnershipTest < ActiveSupport::TestCase
> >   context "for a book and a user" do
> > setup do
> >   @book1 = Factory(:book)
> >   @user1 = Factory(:user)
> > end
> >
> > context "with an ownership relationship" do
> >   setup { @oship1 = BookOwnership.create(:book => @book1, :owner =>
> > @user1) }
> >
> >   should "destroy associated BookOwnerships when Book is destroyed"
> do
> > @book1.destroy
> > assert(@oship1.destroyed?)
> >   end
> >
> >   should "destroy associated BookOwnerships when Owner is destroyed"
> do
> > @user1.destroy
> > assert(@oship1.destroyed?)
> >   end
> > end
> > end
> >
> destroyed? just checks the @destroyed ivar, ie it doesn't check the
> database to see if the object has been destroyed.
> Since rails doesn't have an identity map (yet, it's in the master
> branch), the actual in memory instance that gets destroyed may not be
> @oship1.
> I'd check whether the record is actually gone from the database
>
> Fred
> > Any advice as to what I might do differently here to get the desired
> > behavior?  Am I using this wrong, or is it a bug in Rails?  (Using
> version
> > 3.0.5.)
> >
> > 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.
>
>

-- 
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] has_many with :dependent => :destroy not destroying

2011-03-26 Thread Chris Kottom
I have three models: Book, User, and BookOwnership.  Book and User form an
m--to-n relationship, but because I will have additional information about
the ownership relationships, I cannot use has_and_belongs_to_many, so I've
defined the relationships as follows:

class Book < ActiveRecord::Base
  has_many  :book_ownerships, :dependent => :destroy
  has_many  :owners, :through => :book_ownerships, :class_name => "User"
end

class User < ActiveRecord::Base
  has_many  :book_ownerships, :dependent => :destroy
  has_many  :books, :through => :book_ownerships
end

class BookOwnership < ActiveRecord::Base
  belongs_to  :book
  belongs_to  :owner, :class_name => "User"
end


Based on this, I expect that when I call #destroy on an instance of either
Book or User it should also destroy the associated BookOwnership instances.
 But this doesn't seem to be happening.  Both of the tests below are
currently failing as are similar attempts in console.

class BookOwnershipTest < ActiveSupport::TestCase
  context "for a book and a user" do
setup do
  @book1 = Factory(:book)
  @user1 = Factory(:user)
end

context "with an ownership relationship" do
  setup { @oship1 = BookOwnership.create(:book => @book1, :owner =>
@user1) }

  should "destroy associated BookOwnerships when Book is destroyed" do
@book1.destroy
assert(@oship1.destroyed?)
  end

  should "destroy associated BookOwnerships when Owner is destroyed" do
@user1.destroy
assert(@oship1.destroyed?)
  end
end
end

Any advice as to what I might do differently here to get the desired
behavior?  Am I using this wrong, or is it a bug in Rails?  (Using version
3.0.5.)

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.



Re: [Rails] How to send request client to server using ruby on rails

2011-03-25 Thread Chris Kottom
Please provide (a lot) more information about the two applications if you
want to get constructive answers.

On Fri, Mar 25, 2011 at 9:30 AM, Pranoti Patil  wrote:

> Hello
> I have 2 application one as a client & another as a server i want to
> send a request client application to server application how can i do it
> using ruby on rails  plz reply me as a soon as possible.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] upgrading from Rails 2.1.0 to 3.0 the "right way" makes my head hurt

2011-03-24 Thread Chris Kottom
RVM gemsets will help you manage multiple versions of Rails on a single
system, but the real problem you have is managing the risk that something in
your app will be broken by the upgrade.  If you've got reasonable test
coverage on your application, you'll probably be able to shortcut the
process and skip past most of the patch releases.  (Until something
spectacularly fails, at least.)

On Fri, Mar 25, 2011 at 1:54 AM, Andre Joseph Cubeta wrote:

> Hey bros,
>
> Use Ruby Version Manager.
> It will make your life easier and productivity wise? You're on it ;-)
>
> Thanks!
>
> Andre
>
> On Mar 25, 2011, at 5:48 AM, "sol.manager"  wrote:
>
> > We have an app that is at Rails 2.1.0 and our web developer has let us
> > know going to 3.0 will cost some money. I have embarked on a personal
> > project to see what is involved in getting from 2.1.0 to 3.0. I have
> > the app up and running on 2.2.2 (with some fun along the way) and now
> > tried to get 2.3.4 and see a gem_dependency conflict type issue.
> > On my system I have rails (3.0.5, 3.0.3, 3.0.1, 3.0.0, 2.3.8, 2.3.5,
> > 2.3.4, 2.2.2, 2.1.0, 1.2.6)
> >
> > Do I really need to upgrade each step in-between, including
> > downloading Rails 2.x releases I missed? Is there some reason jumping
> > straight to 3.0 isn't recommended because it looks like it will take
> > me awhile if I have to go through each iteration. I am late to the
> > party, so I am encountering issues long since resolved for others, one
> > by one and having to learn/work my way through the mess at the same
> > time.
> >
> > --
> > 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.
> >
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] The point of HAML

2011-03-24 Thread Chris Kottom
For me, it's because writing markup intended for human beings in a
programmatic style doesn't give me any visual clues as to how it's going to
look.  The whitespace is a convenient but only inciental way of achieving
that.

Builder is totally fine when I'm outputting formatted data like XML because
what little adornment goes into that format isn't something I need to be
conscious of, and in fact, it's probably simpler if I'm not aware of it at
all.

On Fri, Mar 25, 2011 at 4:01 AM, Alex Goldsmith wrote:

> I get what HAML's about, and that it's better than ERB, but why not go
> with something completely Ruby along the lines of XML Builder?
>
> Then you get extensionality and composability for free.
>
> If using indents for structure was that important, why not just use
> Python?
>
> [Genuine question, not a flame.]
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] EULA and downloading softwae

2011-03-24 Thread Chris Kottom
I've never had to do this before, but I would try it as follows:

   1. Store the zip file outside of your public directory.  The user then
   must access the file via the controller action you specify.
   2. Create a controller action somewhere (FileDownloadController?) that
   handles the actual downloading of your file using the
   ActionController::Streaming#send_file method.
   3. Create other controller actions somewhere (EulaController) for display
   and acceptance of your EULA.  The acceptance action should specifically set
   some state in the user's session (or in a cookie, if you want to remember
   that the user accepted the terms between sessions) that indicates that he
   passed this part of the process.
   4. Go back to the original controller used for file download.  Create a
   before_filter that checks for the state you just set before allowing the
   user to execute the download action.  If it is not found, the user should be
   redirected to the EULA display page.

Some variation on that process should get you what you want.

HTH.

On Thu, Mar 24, 2011 at 3:27 AM, Ralph Shnelvar wrote:

> I have a zip file I want to give my users.
>
> But first I need for them to agree to a End User License Agreement
> (EULA).
>
> I can't think of any way to prevent them from going to the download link
> and getting the file without agreeing to the End User License Agreement
> first.
>
> Any suggestions?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] Re: Updating Ruby

2011-03-21 Thread Chris Kottom
+1 for RVM.  There is literally no substitute for the simplicity, the
documentation is excellent, and it's really on its way to becoming the
defacto standard for Ruby deployment (perhaps in competition on MacOS with
Homebrew).  See http://rvm.beginrescueend.com/ for more information.

On Mon, Mar 21, 2011 at 8:50 AM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
> On Mar 21, 6:33 am, Christopher Warrington 
> wrote:
> > I have tried to update my ruby version many different ways, reading
> > forums and the like, and every time, it looks like the
> > installation/upgrade completes without errors, but when I run ruby-v, it
> > still spits out ruby 1.8.7 instead of 1.9.2.
> >
> > The latest that I have tried was to download the newest version of Ruby
> > from ruby-lang.org.
> >
> > Then ran autoconf on the folder.
> >
> > Then ./configure --program-suffix=19 --enable-shared
> > --with-readline-dir=/usr/local .
> > (which was code I found from someone's blog on installing 1.9.1)
> >
> > Then make && sudo make install
> >
> > This didn't update the version.
> >
>
> What you've got above will install ruby 1.9 as ruby19 (and irb is
> irb19 etc.) so running just ruby -v will get you 1.8.7
>
> > I have tried everything that I know how to do in Terminal and by
> > following instructions. Anyone have any ideas?
> >
> rvm is by far the easiest way of handling multiple ruby versions
>
> Fred
> > --
> > 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.
>
>

-- 
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.



Re: [Rails] Service Management

2011-03-19 Thread Chris Kottom
I'm not necessarily an ITIL expert, but I've worked in environments and on
projects where it was essential (technical infrastructure architecture, help
desk application implementation) so I can probably get you pointed in the
right direction.  But because this has been a subject of real interest over
the past few years as Ruby and Rails have matured for serious application
development, there's a lot of information available out there, so don't stop
your investigation here.

There are a lot of different tools that are used for managing Rails
applications.  The best known paid options are probably New Relic RPM (
http://newrelic.com/) and Scout (https://scoutapp.com/) but there are plenty
of open source options that are also used in various combinations (Monit,
Nagios, Ganglia, ...)  The free options will cover infrastructure
status/history and basic service availability just fine.  If you need more
advanced features like performance management, troubleshooting, and inputs
for capacity planning, you might be better served by the paid applications.

As far as scaling goes, there was a series of videos and podcasts done a few
years back called Scaling Rails (http://railslab.newrelic.com/scaling-rails)
that describes a lot of the basic techniques used to improve performance.  A
lot of these have to do with caching and avoiding DB hits whenever possible.
 Beyond that though, I think it still comes down to good architectural
practices like DB management, application layering and partitioning, etc.
 For my money, Cal Henderson's book Building Scalable Web Applications (
http://oreilly.com/catalog/9780596102357) is still the best place to start
reading if you're looking for best practices for web applications in
general.  There was a Rails specific title dealing with scaling and
deployment available a few years back that's now out of print (
http://pragprog.com/titles/fr_deploy/deploying-rails-applications).

Design is too general.  You'd need to be more specific about what you mean
by that.

Testing is an area that's taken very seriously with a lot of competing and
complementary testing tools available.  Get started with the official Rails
guide to testing (http://guides.rubyonrails.org/testing.html) and then if
you're interested in going deeper check out Rails Test Prescriptions (
http://pragprog.com/titles/nrtest/rails-test-prescriptions) and the Rspec
Book (http://pragprog.com/titles/achbd/the-rspec-book).

On Sat, Mar 19, 2011 at 11:21 AM, Fustbariclation <
peter.h.m.bro...@gmail.com> wrote:

> I was just wondering if there was anybody here who'd worked in a
> Service Management environment (ITIL for example).
>
> I'm interested to know of tools for use with planning and managing
> availability, capacity, continuity and security in a RoR environment.
> Particularly the first two.
>
> How easy is it to scale RoR? Can you easily have multiple server
> instances for one service - if so, how do you do it, and what problems
> do there tend to be? How can you predict performance and capacity?
>
> I'm also interested in design and testing considerations.
>
> Much of the above is not, I know, of much direct interest to
> developers, but I'd hope that somebody has been involved with 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-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.
>
>

-- 
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.



Re: [Rails] Re: Back to Basics: Drawing a line between Rails and HTML

2011-03-19 Thread Chris Kottom
> > that) we tend to ignore them. Some of the subjects are too general like
> "I
> > need help" , "I have problems with my Rails application" or "Newbie
> > question". Remember that  questions on this forum are searchable online,
> > posting search engine compatible questions will do us all good. Having
> "good
> > questions" and "straight-forward email subjects" will also help others
> who
> > may be experiencing similar problems like ours. This will help them not
> to
> > replicate the same questions here. There is one thumb rule: if you are
> > failing to ask the question well, then you don't even know what you are
> > looking for.
> >
> > *4. Posting Jobs*
> > =
> > Let me take advantage to remind everyone that when we are posting about
> an
> > open job position or looking for a Rails developer, we are requested to
> > prefix email subject with [JOBS] tag. I cannot say why we need that, but
> > that is a request that is clearly spelled out on the forums page.
> >
> > *5. Readme*
> > =
> > We are all dedicated to providing good and beneficial responses/solutions
> to
> > questions that come on this forum. Let us make sure that we ask those
> > questions that will attract more attention for response, and will in the
> end
> > benefit more people. Remember that the frequent/regular responders (the
> > likes of Brian Crossland, Peter Bell, Fredrick Cheung, Collin Law and
> Chris
> > Kottom, just to mention but a few) on this forum were not specifically
> > employed by this forum to our answer questions, but they do this in the
> > spirit of sharing. They too have other projects and businesses to do, and
> > they get busy too. Some of them only spend limited time looking at forum
> > issues/questions, so they will go for those that are straight-forward and
> > easy to understand.
> >
> > *self.last*
> > ===
> > Enjoy your coding!
> >
> > ---
> > Edmond
> > Software Developer | Baobab Health Trust (http://www.baobabhealth.org/)
> |Malawi
> >
> > Cell:  +265 999 465 137 | +265 881 234 717*
> >
> > My array starts from 0.5*
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Re: Help with find

2011-03-19 Thread Chris Kottom
For slighly more idiomatic Ruby, you could use the attribute name "active"
rather than "is active".  The resulting query would then look something
like:

Province.joins(:cities).where(:active => true).where("cities.active = ?",
true)

On Sat, Mar 19, 2011 at 9:49 AM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
> On Mar 19, 7:11 am, Quee WM  wrote:
> > I have the following
> >
> > class Province < ActiveRecord::Base
> >   has_many  :cities
> >   attr_accessible :name, :is_active
> > end
> >
> > class City < ActiveRecord::Base
> >   belongs_to  :province
> >   attr_accessible :name, :province_id, :is_active
> > end
> >
> > now I want to get all the provinces with is_active = true which have
> > cities with is_active = true
> >
>
> You should be able to do this using the joins option to find (or in
> rails 3 by calling .joins(...)) to join the cities table to the
> provinces one. You'll then be able to write conditions that refer to
> both tables
>
> Fred
> > please guide me on how this can be done.
> >
> > --
> > 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.
>
>

-- 
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.



Re: [Rails] Get started with Ruby

2011-03-17 Thread Chris Kottom
If you want to get rolling quickly, check out http://railsinstaller.org/ from
Engine Yard.

On Wed, Mar 16, 2011 at 4:58 PM, mark goldin  wrote:

> I would like to start learning ROR for server-side web development. My
> front-end is Adobe Flex. What is a development environment to develop
> in Ruby using Windows 7?
>
> 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.
>
>

-- 
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.



Re: [Rails] ssl_requirement plugin still maintained?

2011-03-10 Thread Chris Kottom
Try rack-ssl-enforcer.  It does the same thing using Rack middleware, and
it's being actively maintained.

https://github.com/tobmatth/rack-ssl-enforcer

On Fri, Mar 11, 2011 at 2:01 AM, Todd A. Jacobs <
codegnome.consult...@gmail.com> wrote:

> I was looking at the "official repository" for ssl_requirement at
> https://github.com/retr0h/ssl_requirement, and the last commit was in
> 2008. Is this plugin still maintained? If not, what's the current
> equivalent for Rails 3?
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] which rails ready-made solution for a small simple online shop?

2011-03-09 Thread Chris Kottom
If you're looking for something completely turn-key, check out Shopify.
 Yes, it costs money, but it handles a lot of this stuff for you.

http://www.shopify.com/

On Wed, Mar 9, 2011 at 1:01 PM, Alpha Sisyphus wrote:

> I'm looking for a ready-made solution for a small simple online shop.
> The requirements are the following:
>
> * It works out of the box
> * User-friendly UI: business owner can add, edit, delete products for
> sale, their prices, their pictures and their descriptions
> * Product categories
> * Filtering by category, product name and etc
> * Pre-built themes/templates (I'm not good at web design)
> * No billing support is required
> * SEO-friendly
> * Extensibility (addons/plugins)
>
> Any suggestions?
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Re: Noob Question

2011-03-08 Thread Chris Kottom
Loves me some puzzles.

OK, I think I have the answer.  ActiveRecord::Base has a line in it:

delegate :select, :group, :order, :reorder, :except, :limit, :offset,
:joins, :where, :preload, :eager_load, :includes, :from, :lock, :readonly,
:having, :create_with, :to => :scoped

The method scoped() is defined in ActiveRecord::NamedScope::ClassMethods,
and ActiveRecord::NamedScope is included in ActiveRecord::Base.

Far from obvious, but there it is.

On Tue, Mar 8, 2011 at 7:00 AM, tinkerer13  wrote:

> On Mar 7, 10:12 pm, Bryan Crossland  wrote:
> > Exit the console and edit the class to inherit ActiveRecord::Base.
> >
> > class Foo < ActiveRecord::Base
> >
> > end
> >
> > Start the console again and re-run the command. In the bottom of that
> list
> > you will find the method "where", inherited from ActiveRecord::Base.
> >
> > B.
>
> Ok, now we're getting somewhere...
>
> Looking at the source code for ActiveRecord::Base, I do NOT see
> "where" defined on ActiveRecord::Base. Nor is it defined in any
> superclass (Object). Nor do I see it defined in the docs (under
> methods).
>
> So where the heck is it coming from?  And if it's not defined in the
> docs, how would I know about it?
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Add permitions to registered users

2011-03-07 Thread Chris Kottom
I was looking into Devise and CanCan for the first time just the other day,
and the approach sounds like the one you need.

http://www.tonyamoyal.com/2010/07/28/rails-authentication-with-devise-and-cancan-customizing-devise-controllers/

On Tue, Mar 8, 2011 at 2:14 AM, Zakris Zoukrou  wrote:

> Hello
>
> I create a register/login page to can use it later on my page and i
> want/have to add permissions for the users so that they cant
> delete/comment/etc things from the site that only admins can do!
>
> Can u help me?
> Thank you
>
> Attachments:
> http://www.ruby-forum.com/attachment/6006/scrumptious.rar
>
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] Plugin gems?

2011-03-07 Thread Chris Kottom
Rails has the notion of plugins built into the framework, but conceptually,
they're very different than what WP people are used to.  Essentially you can
think of them as a Rails-specific alternative to Rubygems in that they
provide additional functionality that the developer can incorporate into his
application.  This can include changes in base framework behavior and
application views, but it might also be just an extension mechanism.

Management of Rails plugins is done on the command line; there's no
graphical interface like the plugin screen used by WP Admin because
generally (though not necessarily) you need to also make changes to your
code in order to take advantage of installed plugins.

See: http://guides.rubyonrails.org/plugins.html

On Mon, Mar 7, 2011 at 4:57 AM, Buddy Lindsey, Jr. wrote:

> i am not talking about rubygems.
>
> Is there a gem that can help setup a framework that can allow a rails app
> to have a plugin architecture similar to what wordpress has? I basically
> want to be able to activate and deactivate plugins. What I would like is the
> wordpress plugin architecture or something like it. Am not sure if there is
> a gem for it or what to search for. "plugins" doesn't work to well as a
> search feature and it seems like everything I get form that deals with ruby
> gems.
> ---
> Buddy Lindsey
> http://www.buddylindsey.com
> http://www.twitter.com/buddylindsey
>
> --
> 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.
>

-- 
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.



Re: [Rails] "rails generate" creates application

2011-03-07 Thread Chris Kottom
In order to get the output that you're looking for, you need to type the
following on the command line from your RAILS_ROOT directory:

./script/generate -h

Part of the output should look something like:

Installed Generators
  Builtin: controller, helper, integration_test, mailer, metal, migration,
model, observer, performance_test, plugin, resource, scaffold,
session_migration


On Sun, Mar 6, 2011 at 7:28 PM, Hassan Schroeder  wrote:

> On Sun, Mar 6, 2011 at 10:23 AM, Samuel Sternhagen 
> wrote:
> > I am trying to run the command 'rails generate'. According to
> > RubyonRails.org this should show me what generators are available. When
> > I run the 'rails generate' command with no options it creates an
> > application named 'generate'.
> >
> > Does anyone know why this is happening?
>
> Because the version of Rails you're running is *not* the version that
> guide is describing.
>
> Command syntax changed significantly from 2.x to 3.x .
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> 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.
>
>

-- 
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.



Re: [Rails] Save images

2011-02-22 Thread Chris Kottom
Your instincts on this one are generally correct.  There are some use cases
where storing images in the DB would be useful (e.g. access restriction,
manipulation at the time of the request), but for 98% of all applications,
storing images in public/images will reduce the load on the database and
your application server.

On Tue, Feb 22, 2011 at 2:13 PM, Bhasker Harihara <
harihara.bhas...@gmail.com> wrote:

> Hi All,
>
> I want to give each of my user some 20k of space to load their images or
> pic. for their avatar.
>
> These images will not be sent over the internet.
>
> So is it good to store it in db (I am using mysql) or just in images
> directory.  Uploading is not a problem as it will be done as a one time job
> directly to the server.
>
> I will have plenty of users.
>
> With the limited knowledge of rails and web I have, I find storing it as a
> file in images directory and storing the name of the file in DB very easy to
> achieve.  Please help me with the pros and cons of this approach.
>
> Thanks & Warm Regards,
>
> --
> 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.
>

-- 
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.



Re: [Rails] Re: Cache data set on the server

2011-02-22 Thread Chris Kottom
Regarding the daemon part of your application, I've done something similar
before, and used a combination of Rails-based rake tasks triggered by
Chronic or something similar.  I didn't have the need to manage the cache as
you're describing, but including a task that refreshes cached information
and running it after each update would probably be simple enough.

On Tue, Feb 22, 2011 at 10:59 AM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
> On Feb 22, 9:33 am, Ram Kumar  wrote:
> > Hi,
> >
> > I am new to Rails and I am building a rails server which acts as the
> > backend for a mobile app. I have certain daemon processes that fetch and
> > store data in a database. Every time someone makes a request for data
> > from the phone, I will have to send him the same dataset irrespective of
> > who is requesting the data.
> >
> > This dataset will keep changing quite frequently and my daemons will
> > keep updating the database accordingly. Since the same data is to be
> > sent to every one, I am assuming that it would be best to cache the data
> > on the server and keep updating the cache at a set frequency (thus
> > making only one trip to the db). When I get a request from the phone, I
> > just retrieve this cached dataset and send it back, w/o hitting the db.
> >
> > I think one way of doing this would be to use a singleton model class
> > which will cache the data and this would act as the source. Is this the
> > best way to go about this process? Does Rails provide some other means
> > of doing this?
>
> Rails provides Rails.cache which is an abstraction round several
> different data stores. Personally i wouldn't usually recommend the in
> memory cache you're considering. It means that you have as many copies
> of the data in memories as you have mongrels/passenger instances etc,
> ie you are fetching the data more often than you need. It also makes
> it difficult for you to force expiry of the cache. Most people use
> something like memcache for this job (one of the cache stores
> Rails.cache supports is a memcache store).
>
> You may also want to consider caching at different levels in the
> stack, for example by putting something like varnish in front of your
> web servers.
>
> Fred
> >
> > Thanks,
> >
> > Ramkumar.
> >
> > --
> > 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.
>
>

-- 
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.



Re: [Rails] quick syntax question - newbie

2011-02-21 Thread Chris Kottom
Er, yeah, that's not going to work.  It's actually part of the Ruby standard
lib as part of CGI::HtmlExtension, and now that I'm looking at it more
closely, it's not compatible with Rails use.  My bad.  Rails only supports
the radio_button helper, as Jim pointed out.

On Mon, Feb 21, 2011 at 2:10 AM, Jim Ruther Nill  wrote:

>
>
> On Mon, Feb 21, 2011 at 2:06 AM, Chris Kottom wrote:
>
>> Ah, yes.  Sorry about that.  The radio_group method isn't a part of the
>> FormBuilder, so while you can still call it within the scope of the form_for
>> block, you can't call it the way I told you to.
>
>
> So there really is a radio_group helper? There's nothing about it in the
> api. Any links?
>
>
>>
>> You will need to call it similar to:
>>
>> <%= form_for @post do |f| %>
>>   ...
>>   
>>  <%= radio_group "post[postType_id]", PostType.all(:order => "name
>> ASC").map {|pt| [ pt.id, pt.name ] }
>>   
>>   ...
>> <% end -%>
>>
>> This *should* work if you adjust the code to your particular situation,
>> but post back if not.
>>
>> On Sun, Feb 20, 2011 at 3:48 PM, Jim Ruther Nill wrote:
>>
>>> it should be f.radio_button. more samples at
>>> http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-radio_button
>>>
>>>
>>> On Sun, Feb 20, 2011 at 10:29 PM, señor tower wrote:
>>>
>>>> Chris, thanks.
>>>> but iam getting an this error after trying your code:
>>>>
>>>> *undefined method `radio_group' for
>>>> #*
>>>>
>>>> am not sure if it is because this is a rails 3 app?
>>>> I googled this error but noting seemed helpful
>>>>
>>>> <%= f.radio_group :postType_id, PostType.all(:order => "name ASC").map
>>>> {|pt| [ pt.id, pt.name ] }%>
>>>>
>>>> any further help will be great.
>>>>
>>>> oli.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Sun, Feb 20, 2011 at 2:52 AM, Chris Kottom wrote:
>>>>
>>>>> I think you're looking for something like radio_group.  Based on your
>>>>> previous example, I would code it as:
>>>>>
>>>>> 
>>>>>   <%= f.radio_group :postType_id, PostType.all(:order => "name
>>>>> ASC").map {|pt| [ pt.id, pt.name ] }
>>>>> 
>>>>>
>>>>> On Sun, Feb 20, 2011 at 5:21 AM, oliver torres 
>>>>> wrote:
>>>>>
>>>>>> Hi all, am writing a simple app that lets me pick a post type to go
>>>>>> under National or International.
>>>>>> the code bellow generates  a drop-down   from where I can pick the
>>>>>> options
>>>>>>
>>>>>> 
>>>>>>   <%= f.collection_select :postType_id, PostType.all(:order => "name
>>>>>> ASC"), :id, :name %>
>>>>>> 
>>>>>>
>>>>>> what would be the syntax for this if instead I wanted to have two
>>>>>> radio buttons
>>>>>> I search for some sample code but all i've found is only with hard
>>>>>> coded strings.
>>>>>>
>>>>>> any idea how I can generate two radio buttons for:
>>>>>> O National
>>>>>> O International
>>>>>>
>>>>>> ?
>>>>>> any help will be greatly appreciated.
>>>>>> oli.
>>>>>>
>>>>>> --
>>>>>> 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.
>>>>>>
>>>>>>
>>>>>  --
>>>>> 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

Re: [Rails] quick syntax question - newbie

2011-02-20 Thread Chris Kottom
Ah, yes.  Sorry about that.  The radio_group method isn't a part of the
FormBuilder, so while you can still call it within the scope of the form_for
block, you can't call it the way I told you to.

You will need to call it similar to:

<%= form_for @post do |f| %>
  ...
  
 <%= radio_group "post[postType_id]", PostType.all(:order => "name
ASC").map {|pt| [ pt.id, pt.name ] }
  
  ...
<% end -%>

This *should* work if you adjust the code to your particular situation, but
post back if not.

On Sun, Feb 20, 2011 at 3:48 PM, Jim Ruther Nill  wrote:

> it should be f.radio_button. more samples at
> http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-radio_button
>
>
> On Sun, Feb 20, 2011 at 10:29 PM, señor tower wrote:
>
>> Chris, thanks.
>> but iam getting an this error after trying your code:
>>
>> *undefined method `radio_group' for
>> #*
>>
>> am not sure if it is because this is a rails 3 app?
>> I googled this error but noting seemed helpful
>>
>> <%= f.radio_group :postType_id, PostType.all(:order => "name ASC").map
>> {|pt| [ pt.id, pt.name ] }%>
>>
>> any further help will be great.
>>
>> oli.
>>
>>
>>
>>
>>
>>
>> On Sun, Feb 20, 2011 at 2:52 AM, Chris Kottom wrote:
>>
>>> I think you're looking for something like radio_group.  Based on your
>>> previous example, I would code it as:
>>>
>>> 
>>>   <%= f.radio_group :postType_id, PostType.all(:order => "name ASC").map
>>> {|pt| [ pt.id, pt.name ] }
>>> 
>>>
>>> On Sun, Feb 20, 2011 at 5:21 AM, oliver torres wrote:
>>>
>>>> Hi all, am writing a simple app that lets me pick a post type to go
>>>> under National or International.
>>>> the code bellow generates  a drop-down   from where I can pick the
>>>> options
>>>>
>>>> 
>>>>   <%= f.collection_select :postType_id, PostType.all(:order => "name
>>>> ASC"), :id, :name %>
>>>> 
>>>>
>>>> what would be the syntax for this if instead I wanted to have two
>>>> radio buttons
>>>> I search for some sample code but all i've found is only with hard
>>>> coded strings.
>>>>
>>>> any idea how I can generate two radio buttons for:
>>>> O National
>>>> O International
>>>>
>>>> ?
>>>> any help will be greatly appreciated.
>>>> oli.
>>>>
>>>> --
>>>> 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.
>>>>
>>>>
>>>  --
>>> 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.
>>>
>>
>>  --
>> 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.
>>
>
>
>
> --
> -
> visit my blog at http://jimlabs.heroku.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.
>

-- 
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.



Re: [Rails] Re: [RAILS]

2011-02-20 Thread Chris Kottom
That method and other similar functions were extracted to the Prototype
Legacy Helper plugin in Rails 3.  The replacement method name is
remote_function, though the usage is a little different.  See
http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#method-i-remote_function
.

Check out at https://github.com/rails/prototype_legacy_helper if you want to
use the old syntax, though I expect that best practice is to use the
functionality bundled in the current release.

On Sun, Feb 20, 2011 at 11:58 AM, Poojan  wrote:

> I am trying to make a refresh button that would reload a partial
> _seat_list.html.erd in ajax and I am trying to write it so that it
> works for rails 3. I am also getting this error "undefined method
> `link_to_remote' for #<#:0x2ca2fb8>", which I have
> learned is not now a method in rails 3 and am struggling to write it
> as a link_to
>
> On Feb 20, 7:56 am, Chris Kottom  wrote:
> > Start by describing the problem.  You need to explain what you're trying
> to
> > do and what's not working.
> >
> >
> >
> >
> >
> >
> >
> > On Sun, Feb 20, 2011 at 1:47 AM, Poojan 
> wrote:
> > > Hi,
> >
> > > I am new to rails, and I was struggling on getting this code to work
> > > on rails 3.0.4 and I found out that I need to use the link_to thing
> > > but I am unsure on how to write it for the code below:
> >
> > > 
> > > <%= render :partial=>"seat_list", :locals=>{:seats=>@flight.seats } %>
> > > 
> > > <%= link_to_remote(
> > >   "Refresh seats",
> > >   :url=>"/flights...@flight.id}/seats",
> > >   :method=>"get",
> > >   :update=>"seats") %>
> >
> > > what can I DOO?
> >
> > > --
> > > 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.
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] [RAILS]

2011-02-19 Thread Chris Kottom
Start by describing the problem.  You need to explain what you're trying to
do and what's not working.

On Sun, Feb 20, 2011 at 1:47 AM, Poojan  wrote:

> Hi,
>
> I am new to rails, and I was struggling on getting this code to work
> on rails 3.0.4 and I found out that I need to use the link_to thing
> but I am unsure on how to write it for the code below:
>
> 
> <%= render :partial=>"seat_list", :locals=>{:seats=>@flight.seats } %>
> 
> <%= link_to_remote(
>   "Refresh seats",
>   :url=>"/flights/#{@flight.id}/seats",
>   :method=>"get",
>   :update=>"seats") %>
>
> what can I DOO?
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] quick syntax question - newbie

2011-02-19 Thread Chris Kottom
I think you're looking for something like radio_group.  Based on your
previous example, I would code it as:


  <%= f.radio_group :postType_id, PostType.all(:order => "name ASC").map
{|pt| [ pt.id, pt.name ] }


On Sun, Feb 20, 2011 at 5:21 AM, oliver torres wrote:

> Hi all, am writing a simple app that lets me pick a post type to go
> under National or International.
> the code bellow generates  a drop-down   from where I can pick the
> options
>
> 
>   <%= f.collection_select :postType_id, PostType.all(:order => "name
> ASC"), :id, :name %>
> 
>
> what would be the syntax for this if instead I wanted to have two
> radio buttons
> I search for some sample code but all i've found is only with hard
> coded strings.
>
> any idea how I can generate two radio buttons for:
> O National
> O International
>
> ?
> any help will be greatly appreciated.
> oli.
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] rails new Application create "new" and not "Application"

2011-02-19 Thread Chris Kottom
Syntax for some of the command line tools have changed between Rails 2.x and
3.  The syntax you're using is new as of Rails 3, so you should run

rails -v

to see what you're running.  If it's anything before version 3, you need to
change the syntax of your commands to

$> rails application
$> ./script/server

in order to do what you want to do.

On Sat, Feb 19, 2011 at 12:29 PM, Pietro R.  wrote:

> Hello
>
> I start using RoR on Ubuntu because I want to develop a little bit.
>
> I installed ruby:
>
> $>sudo apt-get install ruby
>
> and it's ok
>
> I installed gem:
>
> $>sudo apt-get install rubygem1.8
>
> I try to install rails with gem:
>
> $>sudo gem install rails
>
> ERROR:  While executing gem ... (Gem::FilePermissionError)
>You don't have write permissions into the /var/lib/gems/1.8
> directory.
>
> so i installed via apt:
>
> $>sudo apt-get install rails
>
> and it's ok.
> Now I tried to start a new application:
>
> $>mkdir ./RailsCode
> $>cd RailsCode
> $>rails new Application
>
> build me "new" and not "Application":
>
> $>ls
> new
>
> also if I try to start server:
>
> $>cd new
> $/new>rails server
>
> rails build up a application named "server"
>
> $/new>ls
> .. ... ... ... server ... ... ...
>
> what can I DOO?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] Re: howto implement a join table

2011-02-15 Thread Chris Kottom
I would do:

   1. rails generate model worker [ definition of model attributes ]
   2. Modify migration file for workers table as needed
   3. Modify app/model/worker.rb to add has_and_belongs_to_many :courses
   4. rails generate model course [ definition of model attributes ]
   5. Modify migration file for course table as needed
   6. Modify app/model/course.rb to add has_and_belongs_to_many :workers
   7. rails generate migration create_course_workers_join_table
   8. Edit this migration to create a new table with the necessary foreign
   keys and following the Rails standard naming conventions (plurals of each
   table name, in A-Z order).

See
http://guides.rubyonrails.org/association_basics.html#creating-join-tables-for-has_and_belongs_to_many-associations
if
you need something more.

On Tue, Feb 15, 2011 at 12:26 PM, Colin Law  wrote:

> On 15 February 2011 10:50, rogi  wrote:
> >
> > On 15 Feb., 11:29, Lorenzo Brito Morales 
> > wrote:
> >> With Active record , its already link it, i mean, whit @worker.courses
> >>  you have a collection of what courses has a worker take it.
> >> With scaffold is to set up custom code to controller/view/model .
> >
> > I dont now about active record! I mean @worker.course doesn't work yet
> > at my project.
> > I just have the two tables and now i try to easily find a way to get
> > the html pages, table structures and relations that allow for linking
> > the courses to the workers?
> > I'm thinking of a manageWorkersCourses.html that let's me select a
> > worker and then add a course from a dropdown list.
> > On the manageWorkersCourses.html page all the courses of the selected
> > worker get listed.
>
> It seems that maybe you are just starting on Rails and have not yet
> acquired some of the basic principles.  I suggest you work through the
> Rails Guides and some tutorials (try http://railsforzombies.org/ and
> railstutorial.org ).  Make sure that any tutorial you use is for the
> correct major version of Rails (2 or 3).  I suggest that you should be
> using Rails 3 if you are not already.
>
> 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.
>
>

-- 
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.



Re: [Rails] fast_xs.c:169: error: ‘struct RArray’ has no member named ‘ptr’

2011-02-14 Thread Chris Kottom
It seems likely that the C extensions in your gem aren't compatible with
your Ruby version.  I used to see errors like this back before the MySQL gem
was updated for Ruby 1.9.

Can you try running under 1.8.7 to see whether you have the same issues?  If
not, you may want to check the source / release notes for the gem to see
whether or not it's been upgraded or whether you have the newest version.

On Tue, Feb 15, 2011 at 1:58 AM, John Merlino  wrote:

> Hey all,
>
> I tried to do bundle install in my Rails 3 project and got this error:
>
> /Users/jmerlino/.rvm/rubies/ruby-1.9.2-p136/bin/ruby extconf.rb
> checking for stdio.h... yes
> creating Makefile
>
> make
> gcc -I.
>
> -I/Users/jmerlino/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1/x86_64-darwin10.2.0
>
> -I/Users/jmerlino/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1/ruby/backward
> -I/Users/jmerlino/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1 -I.
> -DHAVE_STDIO_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O3
> -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith
> -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32
> -Wno-long-long  -fno-common -pipe  -o fast_xs.o -c fast_xs.c
> fast_xs.c: In function ‘fast_xs’:
> fast_xs.c:169: error: ‘struct RArray’ has no member named ‘ptr’
> fast_xs.c:170: error: ‘struct RArray’ has no member named ‘len’
> fast_xs.c:175: error: ‘struct RArray’ has no member named ‘ptr’
> fast_xs.c:176: error: ‘struct RArray’ has no member named ‘len’
> make: *** [fast_xs.o] Error 1
>
> Anyone know what's wrong?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] SQL logging

2011-02-14 Thread Chris Kottom
You should be able to put:

*config.log_level = :debug*

into your config/environments/production.rb file.

Be advised though, this is turned off in production for reasons of
performance, and it shouldn't be used all the time.

On Mon, Feb 14, 2011 at 11:44 AM, loganathan sellappa  wrote:

> Hi,
>
> SQL logging is  working in development environment,but it doesnt in
> production environment ,can anybody help me
>
>
> Thanks&Regards,
> Loganathan.s
>
>  --
> 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.
>

-- 
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.



Re: [Rails] Table structure needed

2011-02-13 Thread Chris Kottom
As far as setting up the many-to-many relationship using
has_and_belongs_to_many, this is pretty well covered in the Rails guide on
Active Record associations (
http://guides.rubyonrails.org/association_basics.html#the-has_and_belongs_to_many-association)
and the API documentation (
http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#method-i-has_and_belongs_to_many).
 I think this answers your question, but repost if not.

On Sun, Feb 13, 2011 at 9:22 AM, rogi  wrote:

> Hi folks
>
> I need to create a "training database". The idea is to track all the
> trainings a workers has participated.
> So I created a table for the workers (basically with field id and
> name) and one for the trainings (id, title decription).
>
> Now the question: How shall I assign the workers to the trainings? For
> each training there will be multiple workers that participated. Can I
> add them to a field of the corresponding trainingstable entry or do I
> need to dynamically create participants tables with one participants
> field?
>
> BR
> rogi
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] [ASK] can't use bundle_fu on rails 3

2011-02-10 Thread Chris Kottom
Please supply a stack trace.

On Fri, Feb 11, 2011 at 5:25 AM, Fery Fery febryan wrote:

> Hi Guys,
>
> basicly, my application use rails 2.1.2, then when i upgrade into rails
> 3.0.3, bundle_fu plugins can't running and this is error message :
> "wrong number of arguments (2 for 1)"
>
> and this is the code for implement bundle_fu :
>
>  <% bundle do %>
>   <%=
> stylesheet_link_tag('jquery.tooltip','main','error','bread_crumb') %>
>   <%= javascript_include_tag(:defaults) %>
>  <% end %>
>
> what i have to do ?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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.



Re: [Rails] Decimal Columns Allow Defaults?

2011-02-10 Thread Chris Kottom
You're missing an "l" in "default".

On Thu, Feb 10, 2011 at 10:54 PM, Karl Smith  wrote:

> Is :default allowed as an option for decimal columns?
>
> A migration:
> class CreateMoney < ActiveRecord::Migration
>  def self.up
>create_table :money do |t|
>  t.decimal :amount, :defaut => 0.0, :precision => 8, :scale => 2
>end
>  end
>
>  def self.down
>drop_table :money
>  end
> end
>
> Creates the following schema:
>
> create_table "money", :force => true do |t|
>  t.decimal  "amount",  :precision => 8, :scale => 2
> end
>
> What happened to the default, it's gone!
>
> Bug? or do decimal columns disallow the :default option? or is it
> because :precision/:scale are also set?
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Gem to work with image attachement

2011-02-10 Thread Chris Kottom
Ruby Toolbox to the rescue.

http://ruby-toolbox.com/categories/rails_file_uploads.html

On Thu, Feb 10, 2011 at 9:15 PM, Peter Bell  wrote:

> Paperclip?
> https://github.com/thoughtbot/paperclip
>
> Best Wishes,
> Peter
>
> On Feb 10, 2011, at 3:13 PM, Andre Fonseca wrote:
>
> I started to develop an upload app. This app will be in Rails.
>
> Can you suggest some GEM that would make it easier to work with image
> attachements? I'm trying to use DragonFly but it creates an unwanted extra
> file
>
> --
> Att
> Andre Fonseca
> http://www.andrefonseca.net
>
> --
> 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.
>
>
>  --
> 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.
>

-- 
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.



Re: [Rails] What does $: point to in a ruby (shell) script?

2011-02-10 Thread Chris Kottom
Yeah, Google doesn't care for punctuation of any kind really.

$. is used to denote the load path for Ruby libraries, so the line that you
have there is to prepend the lib/ directory, which is a peer to the
directory your script is in, to the front of the load path.

FYI, it's aliased as $LOAD_PATH in case you want to change it for better
clarity.

On Thu, Feb 10, 2011 at 4:21 PM, Walter Lee Davis wrote:

> I have a script with the first line as follows:
>
> $:.unshift(File.dirname(__FILE__) + '/../lib')
>
> This must mean something nasty to Google, because I can't seem to get
> anything useful if I include it in a search string, even quoted. Ditto
> stackoverflow and rubytips.
>
> Having this line at the beginning of this script seems to treat the require
>  statements that follow it differently than a normal require
> would, or at least I am not getting the same errors as I do when I require
> the gems without this line.
>
> What does it do?
>
> Thanks,
>
> Walter
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Things that framework other than RoR Cannot do?

2011-02-10 Thread Chris Kottom
It's also important to understand the distinction that Rails and Django are
general purpose frameworks for web development whereas WordPress and Drupal
and the like are content management applications, albeit with many hooks for
developing plugins and extensions to the base app.  So if we take those two
groupings, the answer to your question is "a lot" - general purpose
frameworks are for application development, whereas a CMS is really for
solving a specific subset of web development problems.

HTH...

On Thu, Feb 10, 2011 at 9:43 AM, Michael Pavling  wrote:

> On 10 February 2011 06:59, Julian Leviston  wrote:
> > Mostly, ruby makes experienced programmers happier
>
> Someone asked me the other day why I preferred Rails to any of the PHP
> frameworks (which I occasionally have to work with :-/
>
> "Because Ruby is so pretty!" :-)
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Testing custom rake tasks

2011-02-09 Thread Chris Kottom
Best practice as I understand it is to include all your task logic in a
Rails model and then test that via standard unit testing methods.  The code
in the actual rake task itself should be limited to handling command line
parameters, managing dependencies, and making the call to your model.

On Thu, Feb 10, 2011 at 2:52 AM, Mohammad El-abid wrote:

> So I love testing, but I've only done functional and unit testing via
> the built-in suite. The application I'm working on now has a rake file,
> but I'm clueless as to how I would test it. I need to create some
> records, run the rake, then check these records. I put it in the unit
> tests, but it looked ugly and reloading the records gave me an error. So
> what is the proper way to do this?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, 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.
>
>

-- 
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: Will the sky fall down if I install Ruby on Rails?

2009-10-14 Thread Chris Kottom
Sysadmin 101:  Don't build a playground environment for unfamiliar software
on any server you can't afford to reboot every now and then.  Install it
locally, get familiar with it, and then see if you want to deploy to your
production servers.

Or get yourself a cheap VPS and work out the kinks there.

On Wed, Oct 14, 2009 at 2:22 AM, omar.m  wrote:

>
> Warning: this is a dumb question
> I have a Linux server
> I've heard enough about ROR and want to try out and learn
>
> What will happen if I install ROR?
> Will it effect anything else on my server? Like the OS or databases or
> something else weird?
> How much resources will it use? Does it run all the time or only when
> invoked?
>
> Installation seems to be a few command lines - but I'm just a little
> cautious as the domains I host on my server are sensitive and must
> never go down!!
>
> Also: I have Windows machines
> Can my code be transferred with no alterations to my Linux server?
>
> Thanks
>
>
> Omar
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



  1   2   >