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
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
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).
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
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
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
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.
/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
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
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
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
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
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
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
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
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
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
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
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
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
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
, 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
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
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 =>
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
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
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
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
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
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
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
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:
> 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" />
>
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
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
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
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
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
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
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
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
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
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
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
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
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:
>
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 =>
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
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
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
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
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
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
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
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_
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
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
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
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
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
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
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
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
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
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
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
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
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
>
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 ,
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
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
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:
>
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
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
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
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
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
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
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
>
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
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
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
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:
>
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
84 matches
Mail list logo