Colin Law wrote in post #993612:
> On 18 April 2011 18:22, Tony Tony wrote:
>>
>> The show view form for the comment is the following:
>> However I am getting the following error only when validation fails (if
>> a normal length comment is created the site works):
Hi all,
I recently started back up with Rails and things are going well up until
now.
I've set up acts_as_commentable in my Post model and it's working great.
Problem is users are able to create a "blank" comment. I've added the
following validations in the comment.rb file generated by
acts_as_co
Hi all,
I have a unique workflow where it's making the use of validations
difficult.
My app is for internal use in my company and I have a funky
implementation (inspired by the e-commerce Railscasts episodes) of a
cart. I have products which when I "add to cart" creates an order with a
state of "
Tony Tony wrote:
>
> Any idea how I can display the specific error messages?
>
> Thank you in advance! -Tony
Solved thanks to Salil over in
stackoverflow(http://stackoverflow.com/questions/2638215/rails-does-not-display-error-messages-on-a-form-in-a-custom-method).
"Chan
Hi all,
I've created a custom method called checkout in my app. I create an
order (which is done my adding products to my "cart"), assign it to my
client, and then I head to my checkout screen where I confirm the items
and enter their customer order number and complete the order (submit).
Everyth
babu nair wrote:
> Hi Tony,
>
> Hope ur using Jquery
>
> Add the class to the remove link and add the following line of code
>>
>> <%= f.error_messages %>
>>
>>
>> <%= f.text_field :content %>
>>
>> <% unless f.object.new_record? %>
>> <%= link_to_remove_fields "remove", f,:cl
Hi all,
I apologize for the funky subject of this post.
I have a partial I created while recreating a railscasts example (nested
resources part 2 -
http://railscasts.com/episodes/197-nested-model-form-part-2) and I've
come to a halt.
What I want to do is force a question to be asked if this is a
Not sure if the best part was identical answers or identical answer
times!
This forum kicks butt for putting up and helping us newbies out. Thank
you guys.
-Tony
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on
Michael Pavling wrote:
> On 31 March 2010 15:36, Tony Tony wrote:
>> is there a place where I can learn this kind of thing simple thing?
>
> 'Fraid you've just gotta read the docs and remember as much as you can
> - and be suspicious! If something doesn't
Michael Pavling wrote:
> ".class" doesn't return a string, it returns a class...
>
> <%= content_tag(:li, link_to ("Products", productss_path)) if
> current_user.class == Client %>
>
> but you might be better using "is_a?(base_class)" - depends what the
> intention of your code is:
>
> <%= conte
Tony Tony wrote:
> <%= content_tag(:li, link_to ("Products", productss_path)) if
> current_user.class == "Client" %>
Oops - typo in the above code: products_path not productss_path
Any help is appreciated!
--
Posted via http://www.ruby-forum.com/.
--
You recei
Hi all,
I'm trying to do a condition in my application.html.erb where if a user
is based off of a STI it has a "special" section in the navigation.
The following code correctly prints out the user type (either User or
Client)
[code]
<%= current_user.class if logged_in? %>
[/code]
However, wh
Craig White wrote:
> yes, you misunderstood... sorry if I wasn't clear enough. Something like
> this, definitely not tested and perhaps you can get it down to a single
> query.
>
> Class Pricing
> has_one :customer
> belongs_to :item
>
> id
> price
> customer_id
>
> def self.item_price(item, cus
Craig White wrote:
> I would have a table called pricing and have a column that had the
> customer_id and thus you might have 2 (or more) prices for an item but
> only one for a specific customer or default to the one that is not tied
> to a specific customer.
Hi Craig!
I don't think this would
Anybody have ideas, thoughts or suggestions?
-Tony
--
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-t...@googlegroups.com.
To unsubscribe from t
Hi all,
I have a personal project I'm planning and I came to a small hurdle.
I want to have an item with a price that will be the default for all
clients/users. However, in my business I have some clients that are
grandfathered in to some special pricing. In the case of these
grandfathered in cas
Conrad Taylor wrote:
> On Thu, Nov 12, 2009 at 7:20 PM, Conrad Taylor
> wrote:
>
>>> The code is this...
>>>
>>>
>> <% for task in tasks %>
>>
>>...
>>
>><% tag :hr unless task == tasks.last %>
>>
>
> The above should be
>
> <%= tag :hr unless task == tasks.last %>
>
> -Conrad
Hi all,
I need a very similar functionality to what is displayed on the group_by
Month railscast (http://railscasts.com/episodes/29-group-by-month).
The code is this...
<% @task_months.sort.each do |month, tasks| %>
<%= month.strftime('%B') %>
<% for task in tasks %>
<%= task.na
The Ultimation wrote:
> for migrations, have you tried running rake db:migrate
> RAILS_ENV=production ? That may or may not work. As far as the plugins
> go, you shouldnt need gems to make them work, or if you did you would
> only get an error when trying to use them. I believe paperclip does
Colin Law wrote:
> 2009/9/23 Tony Tony :
>> database for production (same schema) and the site still fails to load.
>> page just in case, Any help is appreciated!!:
>> no such file to load -- application (MissingSourceFile)
>> 2
>> 133 in `require_dependenc
Heinz Strunk wrote:
> Have you tried to run
>
> rake gems:install
>
> on the server to install all required gems?
Yea tried that - there was nothing to install. I think I just figured
out what's partly wrong. I had to install rails 2.3.3 on DH. Now I'm
getting a different error.
Thanks!
--
Hi guys,
I made a quick app for a family member to be deployed on Dreamhost (low
budget). It's my first time deploying on DH so I'm not familiar with the
restrictions.
I'm having an issue where I've been able to get git on both systems and
used capistrano to deploy the app. However migrations fa
Hi all,
Hopefully this is easy for you guys. I'm trying to output a list of
usernames and everything has been working well. However, when I added a
user with a period in their username it generates this error. If I
rename the user to "Tom_Dixon" it works fine, but "Tom.Dixon" fails.
Any clue how
Thanks for the reply Matt!
I did something like this... I'd like to know what you and others think
of it as far as security goes. While it's not a bank or anything, I'd
like my app to be as hacker proof as possible. Any suggestions to make
it more secure are welcome!
Many thanks guys!
--
Solved!
Replace this...
def create_or_update_assets!
# return if there are no asset_attributes
return true if asset_attributes.nil? || asset_attributes.empty?
# pull the attributes from the instance variable
asset_attributes.each do |attributes_hash|
attributes_hash.symbol
Ooops... I copied the older file's create_or_update_assets! method
Just replace "product(s)" with "item(s)". Sorry about that!
-Tony
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Goo
Hi all,
I have paperclip running in my rails environment. I setup a new model
just for paperclip called Assets so that I could upload multiple files
per item (even though I'm only using 1 attachment per item at the
moment). Everything works except for the following:
Updating an item record with
Ahh... there go my hopes for a simple and secure login/logout system!
Many thanks for the useful information before I started ripping my hair
out!
Any suggestions on another easy to implement login/logout system? I
don't require user signups. I just want to hardcode maybe 2 or 3
usernames and
Just realized I posted this to the rails forum instead of the ruby
forum. Sorry!
--
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 thi
Hi all,
I'm writting a small app that requires basic authentication in Sinatra.
I followed the advice of the official Sinatra faq
(http://www.sinatrarb.com/faq.html#auth) and have implemented this code
with success:
[code]
require 'rubygems'
require 'sinatra'
helpers do
def protected!
re
Tony Tony wrote:
>
> My idea of how this *should* work is this:
>
> def create
> @school = School.new(params[:school])
> @school.faculties.admin = true
> ...
> end
>
Okay, I got it to work. However I'd love to hear from you guys if this
is the "pro
Hi all,
I'm using a nested form
(http://railscasts.com/episodes/73-complex-forms-part-1) to set up a
school + faculty user in a single form. Everything works great following
the above screencast. However, I've come to a temporary halt when trying
to make the first user (the same user that's creat
Conrad Taylor wrote:
> In short, the standard way of providing the root page of a web site is
> to
> use an index.[php|html|htm|...] but feel free to use one
> of the methods above to achieve your result.
>
> Good luck,
>
> -Conrad
FANTASTIC! Thanks a lot for the detailed post.
-Tony
--
Po
Hassan Schroeder wrote:
> On Fri, Mar 6, 2009 at 7:37 AM, Tony Tony
> wrote:
>
>> What I want is to have my subdomain root (ex. user.app.com) to point to
>> the user login page (which I currently have working) and the domain root
>> (ex. app.com) to have a typica
Hassan Schroeder wrote:
> On Thu, Mar 5, 2009 at 7:20 PM, Tony Tony
> wrote:
>
>> I'm trying to get map.root to point to a static html file in the public
>> directory. I can't just have index.html since I'm doing subdomains and
>> any index.html fil
Hi all,
I'm trying to get map.root to point to a static html file in the public
directory. I can't just have index.html since I'm doing subdomains and
any index.html file in there will be used as the actual page displayed.
Basically I can point to my subdomain roots just fine, but I need to
find
Matt Jones wrote:
> On Mar 3, 9:26�pm, Tony Tony wrote:
>> bit with security.
>>
>> If moving these tables into one is the best way to go about this, any
>> hints on how to tell teachers apart from students? For example, having a
>> "Teacher page" and
Hey guys,
Hate to be annoying about this, but is unifying these two tables the
best way to go about this?
Obviously students will have completely different levels of access to
the site than teachers. Students will be able to log in and pay fees,
view grades, print homework, etc. Teachers will
Andrew Bloom wrote:
> Just make a users table, and create a polymorphic relationship between
> users and students or teachers. Then, when the user logs in, check if
> they have a student or teacher record associated with them and
> redirect properly.
Thanks for the reply Andrew.
I'll look into h
Hi all,
I'm working on trying to create a login system via subdomains for a
teacher/students.
I have two models at the moment. teacher.rb and student.rb. The fields
in both tables are almost identical. Now I've come add
restful_authentication and I realize this could be a pain with two
tables. I
Craig Demyanovich wrote:
> Using the :foreign_key option isn't incorrect. It's there if you need to
> circumvent the Rails defaults for any reason. If you didn't want to use
> the
> :foreign_key option, you could use a migration to rename the color_id
> and
> color2_id columns in your shirts tab
Thanks for the replies!
Craigs solution worked like a charm.
First time I use foreign_key. I have a feeling that while this worked,
the way it works (specifically having to specify foreign_key) is
incorrect or rather defaults rails conventions. Is this the case? If so
what can or should I
Ideally something like this would be great:
<%=h @shirt.approved_colors.color_id.name %>
Any ideas? I don't know why my brain is shot today. Hate it.
-Tony
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you a
Hi all,
I'm ashamed to ask this but I can't figure it out. Lately my brain gets
more burned out by the minute. Basically I'm trying to have a shirt have
up to 2 colors. I currently have this working. When I edit a shirt, I
can select the primary and secondary color of a shirt. But when I want
to
Billee D. wrote:
> Hopefully I am not misunderstanding your intent here, so please excuse
> me if I am missing something.
>
Hi Billee and thank you for the help!
So far I have all of that pretty much learned. My question (and maybe
I'm misunderstanding this greatly) is how to make an API for
I've done some quick searches on REST API as SOAP isn't recommended by
the rails community.
Came up with this site:
http://hinchcliffe.org/archive/2008/01/10/16613.aspx I'll take a more
in depth look later on.
If anyone else has something to contribute, feel free!
-Tony
--
Posted via http
Thanks for the replies Mukund, Julian, and Comopasta!
@Mukund - I consider it to be a wonderful app ;-) I see this app being
similar and no more complicated than twitterific or tweetie on the
iphone. I'm thinking a SOAP/REST interface is what I will need. Also,
the increased visibility of the
Hi all,
I'm currently close to releasing my first rails app. Many thanks to the
countless people that have helped me with my questions on this forum.
Couldn't have done it without you.
So being close to release I started thinking of neat things I could do,
like making an iphone app. I haven't tr
Tony Tony wrote:
> I even tried doing an
> if statement in the div: !...@tickets.quantity == '2' %>>
Okay, obviously there was a typo which when fixed ended up working.
style="display:none;" not style="hidden".
Hope this helps someone.
-Ton
Chris Bartlett wrote:
> I've just been doing something similar. This works, but might not be
> as Railsy as it could be:
>
> Number of Tickets?
> <%= select :tickets, :quantity, {"1" => "1", "2" => "2"}, {:prompt =>
> 'Select quantity...'}, {:onchange => "if(this.options
> [this.selectedIndex].va
Patrick Doyle wrote:
> Ultimately, I was able to learn enough from reading those to learn that
> (in
> your case) I would want to put a blank tag in my layout where I
> would
> want the "name of guest" stuff to appear, and to populate the "name of
> guest" stuff only when quantity == 2.
>
> I
Hi all,
I'm having a hard time trying to find a good tutorial on how to generate
a field (with ajax) from a dropdown selection.
For example:
I have an app where you can select up to two tickets per person. Only if
the user selects '2' from the dropdown menu should a field pop
up/generate below
Jean-Marc (M2i3.com) wrote:
> Hi Tony,
>
> Look into Ryan Bates Railscasts... there is one talking about
> Capistrano (and his tricks when dealing with images and other "site
> specific" data).
>
> http://railscasts.com/episodes/133-capistrano-tasks
>
> Jean-Marc
> http://m2i3.com/blog/jean-mar
Tim McIntyre wrote:
> But "#{release_path}/public/images/users" will still be symlinked to
> "#{shared_path}/users #{release_path}/public/images/users" and the "r"
> option will remove all files in that directory so I would just remove
> the "r" option and you should be OK. No???
Maybe this mak
Freddy Andersen wrote:
> Hi Tony... the rm line is only there for the release_path directory
> which either will have the symlink OR an empty directory that was
> checked-out from git. If the developers wants a few "test" images in
> git for testing you can do that but need to remove that when it
Tim McIntyre wrote:
> I'd watch out for the "rm -rf #{release_path}/public/images/users"
> line. I think that would remove all your images.
Hi Tim,
Thanks for the tip. I've been busy so I haven't tried to do this just
yet but I'm sure it would remove the images. The idea is to move the
direct
Hi Tim & Freddy,
Thanks for the prompt and insightful replies. I'm glad I got it clear
that this IS how Capistrano is supposed to work and that I shouldn't try
to fight it much.
I wouldn't have even imagined I should have to symlink to get this to
work. I'll give it a try and come back if I h
Hi guys,
So I finally got around to setting up a staging server (ubuntu + apache
+ passenger) and after some headaches got Capistrano (using git as the
scm) to deploy the app to my staging server using a basic deploy.rb
file. Everything seems to be working well, any changes I commit and
deploy ta
I hate to bump and annoy, but can anyone offer a suggestion on my last
reply?
Thanks!
-Tony
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
T
Patrick Sullivan wrote:
> As State Machine plugin. All you need is the plugin and a "state"
> (varchar)
> column in the model's database table. This gives you all kinds of neat
> functionality.
>
Thank you immensely for bring that plugin to my attention. As for the
child naming, I'm using ps
Roy Pardee wrote:
> Well, you can still have those is_whatever? methods--just write them on
> the model your own self:
Touché. Can't believe I didn't think about that! Thank you!!
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this
Roy Pardee wrote:
> I would go with a single 'status' field.
Thanks Roy, I appreciate the reply. I guess I could just do a...
[code]
if @child.status == 'lost'
...
[/code]
I did like the elegance of boolean for things like:
[code]
if @child.is_lost?
...
[/code]
Any other suggestions or o
Hi all,
As usual, you've all been very helpful in the past and I thank you for
continuing to help myself and others.
Today I have the following code/database architecture question which I
would like you guys to help me out with.
Children Table (user has_many children)
--
...
is_l
Hi all,
This forum has been very helpful in the past so I figured I'd try and
ask for some help on some (yet again) rather "newbie" stuff again.
I currently have the following DB Schema (Two Tables Listed here):
Users Table(user has_many children)
---
id
login
...
Children Table
64 matches
Mail list logo