[Rails] Re: Need Quality E-Commerce Samples

2014-10-30 Thread Nicholas Henry
You could take a look at the list of sites on Spree's website (scroll half way down) http://spreecommerce.com/. Spree is an open source e-commerce platform written in Rails. On Wednesday, October 29, 2014 6:17:10 PM UTC-4, john...@gmail.com wrote: > > My boss is finally willing to listen to movi

[Rails] Re: relationship of shopping cart and order

2013-05-19 Thread Nicholas Henry
It important to keep in mind that the episode is focused on PayPal notifications, not describing a fully fleshed out e-commerce domain model. Spree[1] provides a better example of a fully implemented domain model. In Spree, the concept of a 'cart' is implemented using a current order. When an i

[Rails] Re: Use Rails 4 now?

2013-01-05 Thread Nicholas Henry
Linus, I started an application yesterday without any major issues so far. There's been a couple of instances where I've needed to do use a Rails4 branch of a couple of gems I required, however there are not many major Rails 4 API changes (sure there's was a bunch of things extracted as gems).

Re: [Rails] Re: Method not receiving object values

2013-01-03 Thread Nicholas Henry
On Thu, Jan 3, 2013 at 12:02 PM, Javier Quarite wrote: > > > > On Thu, Jan 3, 2013 at 8:52 AM, Dheeraj Kumar > wrote: >> >> No, there isn't. Callbacks are your best bet. >> > > In the end I made a before_validation callback and inside that I'm using the > virtual attribute, but I'm still wonderin

[Rails] Re: Method not receiving object values

2013-01-02 Thread Nicholas Henry
It's possible that the profesion_name is not set yet -- you might want to consider creating the Profesion model in a before_save callback. I suspect there are some issues with how this is model, but hopeful this suggestion will get you moving foward. Cheers, Nicholas On Wednesday, January 2

[Rails] Re: What backup approach for uploaded files stored in file system???

2010-01-04 Thread Nicholas Henry
the archives themselves.Need to backup a new application, just add another config. There are some other alternatives here as well: http://www.ruby-toolbox.com/categories/backups.html HTH, Nicholas --- Nicholas Henry Ruby on Rails Developer nicho...@firsthand.ca Firsthand Web Design and

[Rails] Re: sql default load order

2009-11-18 Thread Nicholas Henry
Add a position column to your table and create a default scope for it. default_scope :order => 'position' --- Nicholas Henry Ruby on Rails Developer nicho...@firsthand.ca Firsthand Web Design and Development p 514.949.6869 Website http://www.firsthand.ca Twitter http://twitter.

[Rails] Re: how to use methods in application_controller in tests

2009-11-17 Thread Nicholas Henry
/authenticated/templates/authenticated_test_helper.rb --- Nicholas Henry Ruby on Rails Developer nicho...@firsthand.ca Firsthand Web Design and Development p 514.949.6869 Website http://www.firsthand.ca Twitter http://twitter.com/firsthand Blog http://blog.firsthand.ca/ Fork me on Github http

[Rails] Re: persist object to table

2009-11-16 Thread Nicholas Henry
or rather: item.create_page(:title => "My Title") unless item.page don't need to explicitly test for nil with an "if" statement. Cheers, Nicholas --- Nicholas Henry Ruby on Rails Developer nicho...@firsthand.ca Firsthand Web Design and Development Website http

[Rails] Re: persist object to table

2009-11-16 Thread Nicholas Henry
hing? Cheers, Nicholas On Nov 16, 9:16 pm, Thufir wrote: > On Nov 16, 4:22 pm, Nicholas Henry wrote: > > > Hello Thufir: > > > I'm not quite sure if I understand you correctly.The collection in the > > documentation refers to a has_many association on the pare

[Rails] Re: persist object to table

2009-11-16 Thread Nicholas Henry
ou wanted to do? Cheers, Nicholas --- Nicholas Henry Ruby on Rails Developer nicho...@firsthand.ca Firsthand Web Design and Development Website http://www.firsthand.ca Twitter http://twitter.com/firsthand Blog http://blog.firsthand.ca/ Fork me on Github http://github.com/firsthand On Nov 15

[Rails] Canadian Ruby on Rails Hosting

2009-10-06 Thread Nicholas Henry
anyone provide recommendations on Canadian hosting for ROR please? Thank you for your time, Nicholas Henry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, sen

[Rails] Re: migrate rails project from 1.1.6 to 2.2.2

2009-09-03 Thread Nicholas Henry
1. acts_as_tree as tree has been move to a separate plugin, you will need to install this: http://github.com/rails/acts_as_tree/tree/master 2. I wouldn't expect you to have any issues with upgrading to Prototype. Do you have much custom javascript code using Prototype? Cheers, Nicholas

[Rails] Re: Can someone explain something to me?

2009-09-02 Thread Nicholas Henry
Hello Chris: I understand what you are attempting to do, but not sure the reasoning behind it. In regards, to a new or edit forms, I would be incrementing the account number when the form is posted. It might be worth looking at the interface patterns developers use for ROR web applications rather

[Rails] Re: Query on updation of versions of ROR.............

2009-09-02 Thread Nicholas Henry
You should update your 2.1.0 rails app with: rake rails:update It appears that boot script is out of date. Cheers, Nicholas On Sep 2, 7:28 am, HUNT HUNT wrote: > I was having Ruby 1.8.7 version & rails 2.1.0 version what was working > fine, > very smooth I ran program. > > I got that new rub

[Rails] Re: migrate rails project from 1.1.6 to 2.2.2

2009-09-02 Thread Nicholas Henry
You may also find this helpful: http://wiki.rubyonrails.org/getting-started/upgrading Especially with links to the release notes to find out what has changed across versions. Cheers, Nicholas On Sep 2, 8:48 am, Raju Aralikatti wrote: > Thank you Marnen I am following the same steps. I am

[Rails] Re: newbie question - limiting record view

2009-08-26 Thread Nicholas Henry
ing if this > will prevent other users from viewing the products created by other > users? That is what I am trying to do. I will test you code ASAP. > > On Aug 26, 10:04 am, Nicholas Henry wrote: >> The simplest thing to do is create a relationship between the record >> and

[Rails] Re: newbie question - limiting record view

2009-08-26 Thread Nicholas Henry
To clarify... def create current_user.products.build(params[:products]) end should have been def create current_user.products.build(params[:products]) # etc end On Aug 26, 1:04 pm, Nicholas Henry wrote: > The simplest thing to do is create a relationship between the record &g

[Rails] Re: newbie question - limiting record view

2009-08-26 Thread Nicholas Henry
The simplest thing to do is create a relationship between the record and the user. If you object/record was product then: class Product belongs_to :user end class User has_many :products end then in your Product controller always access products via the user: def index current_user.produ

[Rails] Re: HTML in error messages

2009-08-24 Thread Nicholas Henry
Off the top of my head a solution to this is using a translation file, it doesn't get escaped AFAIK: http://guides.rubyonrails.org/i18n.html HTH, Nicholas On Aug 23, 4:22 pm, James Englert wrote: > Hey All, > > Rails escapes HTML in error message.  Does anyone know a way to print an > error m

[Rails] Re: Conection

2009-08-24 Thread Nicholas Henry
To access the month parameter: params[:month] You don't need to add the month as an argument to the method. def destroyMonth(month) should be def destroyMonth and if you are following ruby style the method should be written in camel_case def destroy_month Cheers, Nicholas On Aug 22, 12:05

[Rails] Re: count of child model in Model.find

2009-08-07 Thread Nicholas Henry
, John Butler wrote: > > Nicholas Henry wrote: >> Hello JB, >> >> I have tested your query and it works correctly. Perhaps provide the >> error trace and the list might be able to help you further. >> >> Cheers, >> Nicholas >> >> >> On

[Rails] Re: count of child model in Model.find

2009-08-07 Thread Nicholas Henry
Hello JB, I have tested your query and it works correctly. Perhaps provide the error trace and the list might be able to help you further. Cheers, Nicholas On Aug 7, 9:19 am, John Butler wrote: > Hi, > > Im trying to get all the users information along with the total number > of orders they h

[Rails] Re: form_for

2009-08-05 Thread Nicholas Henry
And please post the form_for code. Thank you. On Wed, Aug 5, 2009 at 3:33 AM, Conrad Taylor wrote: > On Tue, Aug 4, 2009 at 9:34 PM, Md Fisa > wrote: >> >> Nicholas Henry wrote: >> > You need to move the :onclick => "ValidateForm()" to :onsubmit =>

[Rails] Re: Best book to learn RoR??

2009-08-04 Thread Nicholas Henry
As a PHP developer you maybe interested in this book: http://www.pragprog.com/titles/ndphpr/rails-for-php-developers Cheers, Nicholas On Aug 4, 7:27 pm, DyingToLearn wrote: > Agile Web Development with Rails 3rd edition > The Rails Way > The Ruby Way > Ruby for Rails (it's a bit old, but has

[Rails] Re: form_for

2009-08-04 Thread Nicholas Henry
You need to move the :onclick => "ValidateForm()" to :onsubmit => "ValidateForm()" in the form_for line. Then when the ValidateForm returns false it will halt submission of the form. You might want to consider using something like this: http://www.livevalidation.com/ There's a Rails plugin as we

[Rails] Re: Undefined method updated? for

2009-08-01 Thread Nicholas Henry
Could you provide the error trace? Cheers, Nicholas On Jul 31, 2:43 am, Himanshu Prakash wrote: > Hi, > I have two model say- > > ZipCode < ActiveRecord::Base > belongs_to :state_provinces > end > > StateProvince < ActiveRecord::Base > has_many :zip_codes > end > > if I do @zip_code.update_atr

[Rails] Re: Replacing render_component

2009-07-31 Thread Nicholas Henry
ree/master This is an improved version of the concept. I haven't tried it out myself, but have been meaning to. Cheers, Nicholas On Fri, Jul 31, 2009 at 11:07 AM, Michael Cugley wrote: > > Nicholas Henry wrote: >> The render_component was extracted as a plugin, so the d

[Rails] Re: Replacing render_component

2009-07-31 Thread Nicholas Henry
The render_component was extracted as a plugin, so the documentation here should explain what render_component is actually doing: http://github.com/rails/render_component/tree/master I have provided an example here of a refactoring based on what you described below: http://gist.github.com/15922

[Rails] Re: model -> model validations

2009-07-30 Thread Nicholas Henry
Hello Chris: There's also an :if option for the validates_associated class method: ":if - Specifies a method, proc or string to call to determine if the validation should occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }). The method, proc or string should

[Rails] Re: model -> model validations

2009-07-28 Thread Nicholas Henry
This maybe of some help: http://railscasts.com/episodes/41-conditional-validations Cheers, Nicholas On Jul 28, 10:15 pm, Me wrote: > If I have a site model that has_many :equipments, how would I validate > the equipment only when ceratin conditions exist in the site model? > > I add the equipm

[Rails] Re: Plugin tests not running

2009-07-27 Thread Nicholas Henry
Hello Cynthia: What you did actually makes perfect sense, but after rails got a wrapper ActiveSupport::TestCase for Test:Unit there seems to be a bit of a conflict with the testing tasks. Option 1: If you want to load the Rails environment then just revert back to RAILS_ROOT and run: rake test:

[Rails] Re: stupid questions about erb

2009-07-27 Thread Nicholas Henry
> On Mon, 2009-07-27 at 18:26 -0700, Nicholas Henry wrote: >> Hello Craig: >> >> <%= stylesheet_link_tag 'reports_print', :media => :all %> >> >> will generate: >> >> > rel="stylesheet" type="text/css" /> >

[Rails] Re: stupid questions about erb

2009-07-27 Thread Nicholas Henry
Hello Craig: <%= stylesheet_link_tag 'reports_print', :media => :all %> will generate: See examples in the documentation: http://railsapi.com/doc/rails-v2.3.3.1/classes/ActionView/Helpers/AssetTagHelper.html#M002343 Cheers, Nicholas On Jul 27, 8:45 pm, Craig White wrote: > I have been tr

[Rails] Re: Simple Captcha - Update attributes?

2009-07-26 Thread Nicholas Henry
Have you tried: @xxx.attributes = params[:blah] if @xxx.save_with_captcha do something else do something end Cheers, Nicholas On Jul 26, 3:42 am, Rails List wrote: > I am using the great simple captcha plugin for saving records like this > > if @xxx.save_with_captcha >    do something

[Rails] Re: actionmailer and local i18n

2009-07-24 Thread Nicholas Henry
Not pretty, but couldn't you patch i18n_action_mailer to work with translator? module I18nActionMailer module InstanceMethods def translate(key, options={}) Translator.translate_with_scope([self.mailer_name, self.action_name], key, options.merge(:locale => self.locale)) end end

[Rails] Re: save! not allowed after validates_uniqueness

2009-07-24 Thread Nicholas Henry
ad_only(StatTest): > ActiveRecord::RecordInvalid: Validation failed: Score aspect has > already been taken >     test/unit/stat_test2.rb:49:in > `test_should_score_aspect_be_read_only' > >   5) Error: > test_should_user_be_read_only(StatTest): > ActiveRecord::Reco

[Rails] Re: Why does this output to the console?

2009-07-17 Thread Nicholas Henry
That should work. Cheers, Nicholas On Jul 17, 8:47 am, JannaB wrote: > so to use your statement, I should put the following in my Associate > model? > > belongs_to :watching_channel, :class_name => "Channel", :foreign_key > => > "watching_channel_id" > > -Janna B > > On Jul 17, 1:09 am, Rodrig

[Rails] Re: strategy for storing/accessing custom attributes?

2009-07-16 Thread Nicholas Henry
Perhaps the serialize method could be helpful: http://apidock.com/rails/ActiveRecord/Base/serialize/class Cheers, Nicholas On Jul 16, 7:02 pm, lunaclaire wrote: > I'm working on a contact management app and 3 of the requirements are: > > * the user should be able to add additional custom Conta

[Rails] Re: Multi check box insertion

2009-07-16 Thread Nicholas Henry
I'm not exactly sure what you are asking for here, but maybe this might be of help: http://railscasts.com/episodes/52-update-through-checkboxes Cheers, Nicholas On Jul 16, 9:40 am, karthik rails wrote: > Hi guys i am new to this community > > is there any link to insert and update Multi check

[Rails] Re: Why does this output to the console?

2009-07-16 Thread Nicholas Henry
I'm not sure, but you probably should rewrite that: if @channel.nil? && !current_associate.watching_channel_id.nil? && current_associate.watching_channel_id > 0 better still why are you checking if watching_channel_id is gt 0? Is watching_channel_id a foreign key for an association for watching

[Rails] Re: undefined method `paginate'

2009-07-14 Thread Nicholas Henry
How is your server configured? Mongrel, passenger? Have you vendored your gems? Cheers, Nicholas On Jul 14, 5:04 pm, Pål Bergström wrote: > How come I get this error? I have the same setup on my local dev machine > as the server where I get the error, using the will_paginate gem and > require

[Rails] Re: Complete Beginner…

2009-07-14 Thread Nicholas Henry
You could take Geoffrey Grosenbach's suggestion and write your own blog: http://nubyonrails.com/articles/about-this-blog-memcached Cheers, Nicholas On Jul 14, 2:46 pm, "Älphä Blüë" wrote: > http://www.ruby-forum.com/topic/191189 > > Start here and click on the very first link in the topic pos

[Rails] Re: Problem with switching rails 2.2.2. application to production

2009-07-09 Thread Nicholas Henry
nment               development > Database adapter          mysql > Database schema version   20090625162758 > > gem list --local yields: > *** LOCAL GEMS *** > > actionmailer (2.3.2) > actionpack (2.3.2) > activerecord (2.3.2) > activeresource (2.3.2) > active

[Rails] Re: Getting ActionController::InvalidAuthenticityToken error Please help tried to run thru the solutions searched via google but no luck

2009-07-09 Thread Nicholas Henry
It's possible that you have a session key left over from a previous app. Try clearing your session cookies and see if that helps. Cheers, Nicholas On Jul 9, 9:25 am, saurabh wrote: > Hi , > > I am trying to test spot.us on my local machine , I installed it and > have rails 2.3.2 but when i reg

[Rails] Re: link_to, how do you combine url options and html_options?

2009-07-07 Thread Nicholas Henry
OK, James, I have tested the following in Rails 2.3.2: link_to "link here", new_object_path, :method => :post, :confirm => 'Press OK', :class => "css_class", :id => "css_id" and this does work as you would expect. What version are you on? On Tue, Jul 7, 2009 at 4:33 PM, Rob Biedenharn wrote: >

[Rails] Re: link_to, how do you combine url options and html_options?

2009-07-07 Thread Nicholas Henry
Based on the documentation: link_to(name, options = {}, html_options = nil) I would expect this is what you are looking for (note haven't tested it): link_to "link here", {new_object_path, :method => :post, :confirm => 'Press OK'), #url options :class =>

[Rails] Re: save! not allowed after validates_uniqueness

2009-07-06 Thread Nicholas Henry
I haven't been able to reproduce the issue that you have been having (on 2.3.2). I created a test suite for your model. Can you run that to see if you get the same problem. http://gist.github.com/141740 Requires mocha, update references to fixtures and fields as required. It's based on the migra

[Rails] Re: Problem with switching rails 2.2.2. application to production

2009-07-06 Thread Nicholas Henry
Can you post your config/environment.rb file please. Cheers, Nicholas On Jul 6, 1:40 pm, sultan wrote: > Problem with switching rails 2.2.2. application to production: > > When I uncomment the following two statements or only the first one > from environment.rb, > ###ENV['RAILS_ENV'] = 'produc

[Rails] Re: save! not allowed after validates_uniqueness

2009-07-04 Thread Nicholas Henry
Can you please explain why you think the validation should be "skipped"? Cheers, Nicholas On Jul 4, 5:59 am, Learn by Doing wrote: > Sorry, I meant The validation should SKIP the instance from which the > method is called.  It appears that save! tries to validate the object > against itself an

[Rails] Re: Application doesn't work on two different machines

2009-07-03 Thread Nicholas Henry
OK, could have been a version conflict between Rails and attachment-fu. One thing I didn't think of asking was to ensure you had run the migrations in production. Pleased to hear you are good to go. Cheers, Nicholas On Fri, Jul 3, 2009 at 12:55 PM, Heinz Strunk wrote: > > I just updated

[Rails] Re: Application doesn't work on two different machines

2009-07-03 Thread Nicholas Henry
I meant attachment_fu On Fri, Jul 3, 2009 at 12:48 PM, Nicholas Henry wrote: > Have you tried updating attribute_fu? Where did you source it from? > > On Fri, Jul 3, 2009 at 12:43 PM, Heinz > Strunk wrote: >> >> Hey, >> >> I was running 2.1.0 on my local

[Rails] Re: Application doesn't work on two different machines

2009-07-03 Thread Nicholas Henry
Have you tried updating attribute_fu? Where did you source it from? On Fri, Jul 3, 2009 at 12:43 PM, Heinz Strunk wrote: > > Hey, > > I was running 2.1.0 on my local machine as well but I updated it to > 2.2.2 but with no effect: > ActionView::TemplateError (undefined local variable or method `fi

[Rails] Re: Application doesn't work on two different machines

2009-07-03 Thread Nicholas Henry
I think in your production environment you are using an older version of Rails (review your error trace): /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/ You should vendor your rails with your application to avoid this in the future. Looks like it's an incompatibility with the version of

[Rails] Re: Application doesn't work on two different machines

2009-07-03 Thread Nicholas Henry
Which version of rails are you developing with locally? On Fri, Jul 3, 2009 at 11:54 AM, Heinz Strunk wrote: > > Yes: > ActionView::TemplateError (undefined local variable or method `filename' > for #) on line #8 of news/index.html.erb: > 5:   > 6:   > 7:     > 8:     <%= image_tag(news.public_

[Rails] Re: Application doesn't work on two different machines

2009-07-03 Thread Nicholas Henry
Putting aside the RMagick issue (can't really help you there), do you have the full error trace for: ActionView::TemplateError (undefined local variable or method `filename' for #) on line #8 of news/index.html.erb: On Jul 3, 11:26 am, Heinz Strunk wrote: > Nicholas Henry wr

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Nicholas Henry
of that. > I think in this case it's best to go with the encrpted filename > option because I'll might have loads of images to render per page. > > Thanks for your help guys. > > Gavin > > > On Jul 3, 3:40 pm, Nicholas Henry wrote: >> You can send a file i

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Nicholas Henry
You can send a file inline without streaming for an image (I'm using this in an application): send_file path, :type => 'image/jpeg', :disposition => 'inline', :stream => false HTH, Nicholas On Jul 3, 10:33 am, Gavin wrote: > > Why not?  It sounds like exactly what you want -- a way to send an

[Rails] Re: ActionWebService - omit backtrace in error response

2009-07-03 Thread Nicholas Henry
I wouldn't have thought the backtrace would be outputted in production mode. Have you tried running in production mode? script/server -e production On Jul 3, 10:23 am, jmfreitas wrote: > I'm using ActionWebService to expose a WebService of my application, > and I would like to control the error

[Rails] Re: Application doesn't work on two different machines

2009-07-03 Thread Nicholas Henry
1. I wouldn't have thought the RMagick version would have mattered, can you confirm the attachment_fu is being deploy to your production environment? 2. Perhaps try upgrading imagemagick first before installing rmagick. Cheers, Nicholas On Jul 2, 10:56 am, Heinz Strunk wrote: > Yeah, it's got

[Rails] Re: Application doesn't work on two different machines

2009-07-02 Thread Nicholas Henry
It looks like you are using a plugin such as attachment_fu. Ensure that you have that included in your deployment to production. Cheers, Nicholas On Jul 2, 9:31 am, Heinz Strunk wrote: > Hello, > > I've got an application which I am developing on a Windows machine and > everything works just f

[Rails] Re: Prototype Event.observe doesn't work in partial

2009-06-30 Thread Nicholas Henry
I suspect the Event.observe(window, 'load', stripe, true); is not executed after an AJAX call, and you will have to call your stripe() function explicitly. Cheers, Nicholas On Jun 30, 6:12 am, Valentino Lun wrote: > Dear all > > I encountered a problem to generate a zebra stripe table. My prog

[Rails] Re: HTML page source not updated.

2009-06-29 Thread Nicholas Henry
If you install the firebug extension for firefox there is an option to view the "generated source". Cheers, Nicholas On Jun 29, 8:14 am, Frederick Cheung wrote: > On Jun 29, 7:29 am, Valentino Lun > wrote:> Dear all > > > After I search something, it can successfully display the result in the

[Rails] Re: redirect route after destroy doesn't work

2009-06-29 Thread Nicholas Henry
Nothing that stands out here (to me), would you mind posting your routes file. Cheers, Nicholas On Fri, Jun 26, 2009 at 1:34 PM, Herman Müller wrote: > > Hi Nicholas, > > thanks for your answer. > > Unfortunately i have no functional test, but here is my entire > controller: > > class T

[Rails] Re: redirect route after destroy doesn't work

2009-06-26 Thread Nicholas Henry
Can you post the entire controller so we have some context of the surrounding code? Might be easier to debug what is going on. Do you have a functional test for it? Cheers, Nicholas On Jun 26, 4:40 am, Herman Müller wrote: > Hi Ruby Community, > > after destroying a record, ruby (2.2) don't us

[Rails] Re: session cleanup

2009-06-25 Thread Nicholas Henry
for databased session > > 2009/6/25 Nicholas Henry > > > > > > > yes to which one? > > > On Thu, Jun 25, 2009 at 3:08 PM, gaoxh gaoxh04 wrote: > > > yes.. > > > > 2009/6/25, Nicholas Henry : > > > >> Do you mean how to timeout a ses

[Rails] Re: session cleanup

2009-06-25 Thread Nicholas Henry
yes to which one? On Thu, Jun 25, 2009 at 3:08 PM, gaoxh gaoxh04 wrote: > yes.. > > 2009/6/25, Nicholas Henry : >> >> Do you mean how to timeout a session, or clean up old sessions in the >> database (when using table-based session, opposed to cookie-based >> ses

[Rails] Re: session cleanup

2009-06-25 Thread Nicholas Henry
Do you mean how to timeout a session, or clean up old sessions in the database (when using table-based session, opposed to cookie-based sessions)? Cheers, Nicholas On Jun 24, 11:22 pm, Xiahong Gao wrote: > Hi everyone, > > I am a newb. Can anyone tell me how to do session cleanup? I want to >

[Rails] Re: how to get all associations info from an ActiveRecord model Class ?

2009-06-24 Thread Nicholas Henry
Try: self.class.reflect_on_association(:documents).options See: http://api.rubyonrails.org/classes/ActiveRecord/Reflection/ClassMethods.html HTH, Nicholas On Jun 24, 7:16 am, Erwin wrote: > I have defined in my Library model > > belongs_to :academy > has_many :document,  :order => :title ,

[Rails] Re: serialize methods by to_json

2009-06-23 Thread Nicholas Henry
I don't believe you can pass params using the methods option. One approach would be to calculate the outcome on the collection before calling to_json. def calculate_outcome(arg) @outcome = # do calculation with arg end def outcome @outcome end collection.each {|c| c.calculate_outcome(arg)} c

[Rails] Re: Div is shown only from the layout nowhere else

2009-06-22 Thread Nicholas Henry
OK, so you know what you need to do then? On Mon, Jun 22, 2009 at 11:40 AM, Kostas L. wrote: > > Yes you are correct. I am only creating a @cart variable in the store > controller. > > On Jun 22, 6:32 pm, Nicholas Henry wrote: >> So I guess that means in the other co

[Rails] Re: Div is shown only from the layout nowhere else

2009-06-22 Thread Nicholas Henry
at i have in my > cart. But when i use debug in some other controller e.g products, i > get nothing. > > Kostas > > On Jun 22, 5:55 pm, Nicholas Henry wrote: > > > > > Are you creating the @cart instance variable? Your code suggests that > > this is null: >

[Rails] Re: Div is shown only from the layout nowhere else

2009-06-22 Thread Nicholas Henry
Are you creating the @cart instance variable? Your code suggests that this is null: <% if @cart %> Try some debug code in your layout to see what @cart is, <%= debug @cart %> or better still right a test. Cheers, Nicholas On Jun 22, 10:37 am, "Kostas L." wrote: > Hi guys! > I have a litt

[Rails] Re: One Quick help needed !

2009-06-19 Thread Nicholas Henry
You can only access column attributes this way not, associations. http://railsapi.com/doc/rails-v2.3.2.1/classes/ActiveRecord/Base.html#M001055 Cheers, Nicholas On Jun 19, 9:26 am, Sandip Ransing wrote: > Hello Friends ! > from my script/console > I am getting channel blog feature as below>>Ch

[Rails] Re: Odd error with file_column and relative_path

2009-06-18 Thread Nicholas Henry
Check out the documentation: * in a view, "<%= url_for_file_column 'entry', 'image' %> will create an URL to access the uploaded file. Note that you need an Entry object in the instance variable @entry for this to work. So the line in your index view: <%= image_tag url_for_file_column("item

[Rails] Re: controller subfolders and routing

2009-06-17 Thread Nicholas Henry
I would avoid ever using a hash to specify a path. Always use named routes. If this is your root of your application then try this: # use root_path in your views map.root :controller => "home" # :action => "index" is implied or if not, then create a named route # use home_path in your views ma

[Rails] Re: how to change quantity to cart?

2009-06-17 Thread Nicholas Henry
The code you provided in your form: Qty : <%= text_field_tag 'quantity', '1', :size => 2, :maxlength => 2 %> <% form_remote_tag :url => {:action => 'add_to_cart', :id => product } do %> <%= submit_tag "Add to Cart" %> <% end %> You need to have

[Rails] Re: RESTful form_for generation

2009-06-16 Thread Nicholas Henry
Try the following steps: 1. Remove :url => { :action => "update" }, you do not need this as the [...@academy, @ecourse ] will generate the correct path and the :html => {:method => :put} will generate the correct method for submission 2. Check that @academy is not nil, but off the top of my head

[Rails] Re: controller subfolders and routing

2009-06-15 Thread Nicholas Henry
You don't need to namespace the model as well. ./script/generate model Admin::Link (not necessary) ./script/generate model Link On Jun 15, 11:49 pm, Sijo Kg wrote: > Hi zambezi >    When create a controller do like > ./script/generate controller Admin::Links > > Note : plural for controller >

[Rails] Re: controller subfolders and routing

2009-06-15 Thread Nicholas Henry
ucts/rest-for-rails-2 Cheers! Nicholas On Jun 15, 6:47 pm, zambezi wrote: > Thanks to Nicholas Henry and Sijo Kg for responding. > > Having to add the routes to the routes.rb file still seems a > cumbersome approach, but so be it.  Unfortunately it isn't working as > I raise a Routi

[Rails] Re: Splitting the user into user and user_profile

2009-06-15 Thread Nicholas Henry
If you are versioning records, as in your UserProfile, then you may want to consider a plugin that does this for you. Consider this: http://github.com/technoweenie/acts_as_versioned/tree/master HTH, Nicholas On Jun 15, 12:49 am, "s.ross" wrote: > Hi-- > > On Jun 14, 2009, at 1:09 PM, arnekolja

[Rails] Re: controller subfolders and routing

2009-06-14 Thread Nicholas Henry
Check that you have done the following (using admin/ products_controller.rb as an example): # 1. Namespace your routes in routes.rb map.namespace :admin do |admin| admin.resources :products admin.resources :orders # add other resources here end # 2. Namespace your controllers class Admin

[Rails] Re: Steps to use Ruby on rails

2009-06-14 Thread Nicholas Henry
I would recommend checking out the Rails Guides[1], specifically the Getting Started Guide[2]. This should get on the right track. Hope this helps. [1] http://guides.rubyonrails.org [2] http://guides.rubyonrails.org/getting_started.html Cheers, Nicholas On Jun 14, 6:49 pm, Ar Chron wrote: >

[Rails] Re: has_many :through a belongs_to association

2008-11-13 Thread Nicholas Henry
I've tried a couple of forks on Github as well with no luck. Would love to see this work on Rails 2.2 as well. Nicholas ed wrote: > @edvin: Tag-related: > http://github.com/tejo/has_many_polymorphs/commit/a3710a131e0bcfc1d1939f28246f4e9f60732835 > > I'm porting a 1.2.6 app to 2.2.0 and found