[Rails] Re: Instance variable looses value upon render

2014-10-10 Thread Ronald Fischer
Oh, I really got this wrong. So, the HTML is already constructed with the render call, then the rest of the action is executed! Thanks a lot. Ronald -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails:

[Rails] Instance variable looses value upon render

2014-10-08 Thread Ronald Fischer
the after_action is executed. I understood the render() function in that way, that it only sets up which ERB template is supposed to be used, but actual rendering would occur only when the action has finished. Did I get this wrong? Ronald -- Posted via http://www.ruby-forum.com/. -- You r

[Rails] Re: Forgot to define action - but no error! How is this possible?

2014-09-08 Thread Ronald Fischer
Muskalek wrote in post #1157141: > This is expected behaviour. I see! Thank you for pointing it out! At times, the plethora of automatisms found in Rails is a bit creepy I always had the habit to explicitly define my actions, so I didn't stumble over this one earlier. Ronald --

[Rails] Forgot to define action - but no error! How is this possible?

2014-09-08 Thread Ronald Fischer
didn't put one in ApplicationController). Actually, the only other home method I have is in a completely unrelated controller. I wonder how it can be, that clicking on the admin_pages_home_path link, didn't raise an exception. Ronald -- Posted via http://www.ruby-forum.com/. -- You r

[Rails] Re: is_a? returns false, though I think it should return true

2014-09-07 Thread Ronald Fischer
lass of n derives from ActiveRecord::Base, i.e. a class, which I can't control. Now imagine that in a new version of Rails, this class would receive a to_int method (for example, to implicitly convert a model object into the id of the object). This would break my code. Ronald -- Posted via http://ww

[Rails] Re: Password filtering does not work

2014-09-03 Thread Ronald Fischer
Hassan Schroeder wrote in post #1156593: > On Tue, Sep 2, 2014 at 5:26 AM, Ronald Fischer > wrote: >> In my Rails 4 application, when I have a form including a password, i.e. > >> I don't like the fact that the password is shown plain text in the log >> file

[Rails] Password filtering does not work

2014-09-02 Thread Ronald Fischer
In my Rails 4 application, when I have a form including a password, i.e. <%= password_field_tag 'admpwd', nil, size:32, maxlength: 32, class: 'admentry' %> I don't like the fact that the password is shown plain text in the log file, and would like to disable this. I found several suggestions t

[Rails] Re: is_a? returns false, though I think it should return true

2014-09-01 Thread Ronald Fischer
;t have any semantic on its own, doesn't look like good design either. What approach would you suggest? Ronald -- 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 unsubscribe fro

[Rails] Re: is_a? returns false, though I think it should return true

2014-08-30 Thread Ronald Fischer
s bitten by it. Ronald -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@goo

[Rails] is_a? returns false, though I think it should return true

2014-08-30 Thread Ronald Fischer
Rails 4, Ruby 2 Model has Card and Idiom and Idiom belongs_to :card In my Rails console I have an Idiom i and get the card from it: c=i.card => # Now I do: c.is_a?(Card) => false c.instance_of?(Card) => false Ooops! Why false in both cases? c.class.name => "Card" c.

[Rails] Design Question: User-managed static pages

2014-08-17 Thread Ronald Fischer
mmits" them to the general public. This will be important, if he really uses <%...%> tags, because he won't have a Rails environment when creating the pages. What do you think about this design? Ronald -- Posted via http://www.ruby-forum.com/. -- You received this message becau

[Rails] Re: Re: Issues with catenating the results of two queries + will_paginate

2014-08-16 Thread Ronald Fischer
Walter Davis wrote in post #1155322: > On Aug 16, 2014, at 9:42 AM, Ronald Fischer wrote: > >> Walter Davis wrote in post #1155317: >>> But adding the two together must (I am >>> guessing here) cause them to both be evaluated as arrays before the >>> additio

[Rails] Re: Issues with catenating the results of two queries + will_paginate

2014-08-16 Thread Ronald Fischer
Colin Law wrote in post #1155319: > On 16 August 2014 11:03, Ronald Fischer wrote: > Would it be possible to combine the two queries into one - Dict.where( > ... or ... )? Then you would not need to concatenate them. Technically, yes, and it likely would be a performance improv

[Rails] Re: Issues with catenating the results of two queries + will_paginate

2014-08-16 Thread Ronald Fischer
ill is a Dict::ActiveRecord_Relation. The conversion into an Array must come after that, and this means it must happen inside paginate(). Ronald -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk&quo

[Rails] Issues with catenating the results of two queries + will_paginate

2014-08-16 Thread Ronald Fischer
(Rails 4, Ruby 2) I have two functions which query the database. Both yield a set of model objects. These two sets should be catenated and presented to the user using the will_paginate Gem. I think I understand now how to do it, but a few issues with this are still puzzling me. Here are the query

[Rails] Re: password validation triggered even I update non-password attribute

2014-08-04 Thread Ronald Fischer
.. } I would have written -> { ... } Are both notations exactly the same? > Also, read this book: Thank you for the recommendation! Ronald -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails:

[Rails] Re: password validation triggered even I update non-password attribute

2014-08-04 Thread Ronald Fischer
rams hash, if both are empty, and I also remove the user id, if it has not changed (because there is an index on it, and I don't want to trigger unnecessary index update operations). After this, I pass the params to update_attributes. When it comes to updating profile information, I had expect

[Rails] Re: password validation triggered even I update non-password attribute

2014-08-02 Thread Ronald Fischer
plication, because I often have the case that I will update only some of the attributes. I wonder *why* validates looks at attributes which are not part of the update. Is there a use case where this makes sense? Ronald -- Posted via http://www.ruby-forum.com/. -- You received this message bec

[Rails] password validation triggered even I update non-password attribute

2014-08-01 Thread Ronald Fischer
I have a User model: create_table "users", force: true do |t| t.string "name" t.string "email" t.datetime "created_at" t.datetime "updated_at" t.string "password_digest" end add_index "users", ["name"], name: "index_users_on_name" Then, I have the following validat

[Rails] Re: (Occasionally) display DateTime as local time

2014-07-28 Thread Ronald Fischer
Scott Ribe wrote in post #1153641: > And if you don't want to change the RoR default, you can think up your > own name and add your own setting to the config. No, the Rails default is fine. I'll go with the solution proposed by Colin. Ronald -- Posted via http://www.ruby-foru

[Rails] (Occasionally) display DateTime as local time

2014-07-27 Thread Ronald Fischer
ions to see, whether there is something like "getlocal" or "localtime", but there doesn't seem to be one. to_formatted_s looked promising, but I didn't find anysthing in the possible time format specifiers which would help me here. Ronald -- Posted via http://www.

[Rails] Re: ActiveRecord: moving all children to a new parent

2014-07-23 Thread Ronald Fischer
Ah, I have set it to :destroy! But why do I get the error when I assign to pto.children? I would expect such an error then when pfrom is deleted. Ronald -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on

[Rails] Re: ActiveRecord: moving all children to a new parent

2014-07-23 Thread Ronald Fischer
Matt Jones wrote in post #1152815: > On Friday, 18 July 2014 02:24:59 UTC-4, Ruby-Forum.com User wrote: > saved_children = pfrom.children.to_a > pfrom.children = [] > pto.children = pto.children + saved_children. I finally found the time to rewrite this part of my application according to this su

[Rails] Re: ActiveRecord: moving all children to a new parent

2014-07-18 Thread Ronald Fischer
I am stunned! Every day I like Rails more Thanks a lot! Ronald -- 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 unsubscribe from this group and stop receiving emails fro

[Rails] Re: Upload UTF-8 encoded textfile

2014-07-17 Thread Ronald Fischer
BOM at the moment, it is likely that sooner or later I will also have to support uploading of files which contain a BOM. Ronald -- 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 u

[Rails] Re: ActiveRecord: moving all children to a new parent

2014-07-17 Thread Ronald Fischer
Walter Davis wrote in post #1152668: > On Jul 17, 2014, at 7:27 AM, Ronald Fischer wrote: >> pfrom = Parent.find_by_id(from_id) >> children formerly belonging to pfrom, and iterating over pfrom shows >> the case? How then would I correctly implement the "move". &g

[Rails] Re: Re: Upload UTF-8 encoded textfile

2014-07-17 Thread Ronald Fischer
encoding *can* be called - it just fails. We have nearly everything in place. Now, if we can find out WHY set_encoding fails (and this might be a generic Ruby question), we can find out what Rails (or the programmer) can do to let things go smoothly Ronald -- Posted via http://www.ruby-fo

[Rails] ActiveRecord: moving all children to a new parent

2014-07-17 Thread Ronald Fischer
I have a models Parent and Child, an the following association: Parent has_many :children, dependent: :destroy Child belongs_to :parent Further, I have two Parent instances: pfrom = Parent.find_by_id(from_id) pto = Parent.find_by_id(to_id) My goal is to transfer all children from pto t

[Rails] Re: Upload UTF-8 encoded textfile

2014-07-17 Thread Ronald Fischer
As far I understand this article, this related to Rails 3 and MySQL, and how to use UTF8 encoded data everywhere. I don't know about MySQL, but Rails 4 and Ruby 2 with SQLite don't suffer this problem: I didn't have any trouble, processing all kinds of Unicode characters with my application, an

[Rails] Re: Upload UTF-8 encoded textfile

2014-07-16 Thread Ronald Fischer
Yes, it is, as I found by trial-and-error. Note that the object is not just a File, it is of class Tempfile. I think this is quite common when working with a Tempfile object. To make a Tempfile threadsafe, you have to combine the creation of the filename and the creation of the file into one ca

[Rails] Re: Validation in a 3-level association

2014-07-15 Thread Ronald Fischer
Rails maybe has some built-in feature for this which I just am not aware of. Ronald -- 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 unsubscribe from this group and stop rece

[Rails] Re: Upload UTF-8 encoded textfile

2014-07-15 Thread Ronald Fischer
In this case, it is pretty certain that ever file will contain UTF-8 characters, and in general, I think the cases are few where we can assume input to be represented by 7-bit-ASCII. What I do not know for sure is whether or not the file will have a BOM, but I think Ruby can figure this out aut

[Rails] Validation in a 3-level association

2014-07-14 Thread Ronald Fischer
constraint would require uniqueness within a certain B, I could write validates :ccol, uniqueness: { scope: :B_id } But since C doesn't contain an A_id as foreign key, I can not express it in this way. Is there a possibility to achieve this? Ronald -- Posted via http://www.ruby-foru

[Rails] Upload UTF-8 encoded textfile

2014-07-14 Thread Ronald Fischer
My Rails application (Rails 4.1, Ruby 2.1.1) offers the user to upload a file. This file will then be parsed by the application, and after the parsing is done, it is deleted from the upload area. So far, I have the following: In my upload form, I have <%= file_field_tag :upload, {accept: 'te

[Rails] Re: counting the result of a join (SOLVED)

2014-07-10 Thread Ronald Fischer
The solution is found here: http://stackoverflow.com/questions/24607428/rubyonrails-counting-the-result-of-a-join Basically, I need to specify in my :dicts model, that there is an association to :cards # in class Dict: has_many :idioms, through: :cards After this, I can do: idioms.where(kind

[Rails] Re: Heroku vs. local WEBrick: How could be this error be undetected?

2014-07-10 Thread Ronald Fischer
It's 2.1.1p76 in both cases. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@goog

[Rails] Heroku vs. local WEBrick: How could be this error be undetected?

2014-07-08 Thread Ronald Fischer
cal system? Ronald -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegr

[Rails] Re: Changing display text of submit button without changing value passed to controller

2014-07-08 Thread Ronald Fischer
which I would *really* find satisfying, so maybe I will just go for the one which is least ugly. :-D Thank you a lot for providing such an elaborate example Ronald -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "R

[Rails] Re: Changing display text of submit button without changing value passed to controller

2014-07-08 Thread Ronald Fischer
ot; buttons places some code into this field (say, 0 for reject and 1 for accept) and then calls form.submit(). My controller only checks for the 0 or 1, and is never aware of the actualy value of the buttons. Actually, the controller doesn't need to check any button in this solution. Rona

[Rails] Re: Changing display text of submit button without changing value passed to controller

2014-07-08 Thread Ronald Fischer
ding to which button has been clicked) into the hidden text field, and calls form.submit() - My controller doesn't do a check on the button, but on the hidden textfield, to determine which button has been clicked. What do you think about this way of doing it? Ronald -- Posted via

[Rails] Changing display text of submit button without changing value passed to controller

2014-07-07 Thread Ronald Fischer
quot; and "reject". Clicking on the first button would pass "judgement" => "accept" to the application. This is exactly what I want, but I want to be able to change the text which is visible on the button (for example, when displaying the page in a different langu

[Rails] Re: Can I do <%=.%> interpolation without getting a tag?

2014-07-07 Thread Ronald Fischer
Thanks a lot, this is the solution I was looking for! -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonra

[Rails] Re: Can I do <%=.%> interpolation without getting a tag?

2014-07-07 Thread Ronald Fischer
> If you just want to print out the bare text, you can just put that in > your > erb tag: <%= my_variable %> This didn't work either, because the value of my_variable contains simple quotes, and these had been replaced by an HTML entity denotation (in this case, it is '). That's why I thought I

[Rails] Can I do <%=.%> interpolation without getting a tag?

2014-07-07 Thread Ronald Fischer
I have in my erb file something like this: <%= simple_format(...) %> The generated code is wrapped within . In my case, I need the code be interpolated without this wrapping. Can this be done? Ronald -- Posted via http://www.ruby-forum.com/. -- You received this message because y

[Rails] Messages "Binary data inserted for `string`", but encoding looks OK to me

2014-07-06 Thread Ronald Fischer
This is an excerpt from a rails console session: 2.1.1 :011 > x=User.new({name: 'x', email: 'x...@example.org', password: '', password_confirmation: ''}) => # 2.1.1 :012 > x.save (0.2ms) begin transaction Binary data inserted for `string` type on column `name` User Exists (

[Rails] Active Record sorting using Ruby sort function

2014-07-04 Thread Ronald Fischer
to convert the ActiveRecord::Relation to an array is a good idea. Maybe there is a better way to implement sorting? Ronald -- 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 unsubscribe

[Rails] Active Record: Eager Loading (syntax question)

2014-07-02 Thread Ronald Fischer
Let's have model :parents and :children, where one parent can have many children, and that I want to do something like this: plist=Parent.joins(:children).select('*').where("parents.id=children.parent_id and children.cfield=#{...}") plist.each { |p| do_something_with(p,p.children) } Now I learne

[Rails] counting the result of a join

2014-07-02 Thread Ronald Fischer
I have in my model :dicts, :cards and :idioms. Each Dict has many Cards and each Cards has many Idioms. Also, :idioms has an Integer column :kind. I would like to find out, whether a certain dict object has at least one Card which has at least one Idiom where :kind has a certain value. This is

[Rails] Re: nokogiri missing libiconv error. Chapter 3 of RoR book tutorial

2014-07-02 Thread Ronald Fischer
Could it be that you are running OSX 10.6? I have the same problem, and already contacted the nokogiri supporters. At least on *this* OSX version. it doesn't work. I have also informed Michael Hartl to consider this in the next update of his tutorial. You will have to do without Capybara. --

[Rails] Re: What is a good practice for storing additional classes

2014-06-26 Thread Ronald Fischer
in controllers, but they still would be available in views too). I see that there are several ways to do it. Could you also explain, why my naive approach (to create a separate "lib" subdirectory below "app" and put everything there) would be a bad idea? I have never s

[Rails] What is a good practice for storing additional classes

2014-06-26 Thread Ronald Fischer
My Rails application also contains classes which are independent from the Rails framework, in that they could be reused unchanged if I would, for example, created a non-web-based, command-line version of my app. Such a class could be one which implements business logic, or a simple utility class.

[Rails] Re: Button invokes "update" instead of "index"

2014-06-19 Thread Ronald Fischer
Walter Davis wrote in post #1150186: > On Jun 19, 2014, at 2:09 AM, Ronald Fischer wrote: > >> Does this mean that I can't solve this with a *button*, but would have >> to use a *link* instead? > > It's important to note that you may style a link to look like an

[Rails] Re: Button invokes "update" instead of "index"

2014-06-18 Thread Ronald Fischer
Does this mean that I can't solve this with a *button*, but would have to use a *link* instead? -- 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 unsubscribe from this group and stop receiving

[Rails] Re: DB query: Finding only the id values

2014-06-18 Thread Ronald Fischer
Walter Davis wrote in post #1150083: > You say tainted, and I hear Soft Cell... This too, of course ;-) Ronald -- 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 unsubscribe fr

[Rails] Re: DB query: Finding only the id values

2014-06-18 Thread Ronald Fischer
ich don't actually fetch > anything until you want to look at them). It's a brilliant > implementation pattern, but counter-intuitive to newbies. It's just "lazy evaluation" at work, and as such not so much "counter-intuitive". It's only that it is not

[Rails] Re: DB query: Finding only the id values

2014-06-18 Thread Ronald Fischer
rity vulnerability for SQL injection. Oh, you are absolutely right. I see the danger. These are the times where I'm missing Perl's concept of "tainted" strings... Ronald -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the

[Rails] Re: CSS Load Order Headache

2014-06-18 Thread Ronald Fischer
this warning too! While I don't feel so comfortable with Bootstrap, I am currently looking for other libraries and will probably face this problem again. Ronald -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby o

[Rails] Button invokes "update" instead of "index"

2014-06-18 Thread Ronald Fischer
I have nested resources resources :dicts do resources :cards end and in my form form_for [@dict,@card] do |f| I have the following button: <%= f.submit('LIST ALL', url: dict_cards_path(@dict.id), class:'kanren_button', name:'list_all', method: :get) %> The generated HTML code is:

[Rails] Re: finding associations in sorted order

2014-06-18 Thread Ronald Fischer
Thanks to all contributors! Hassan Schroeder's sharp eye finally spotted the culprit. -- 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 unsubscribe from this group and stop receiving emails fr

[Rails] Re: finding associations in sorted order

2014-06-17 Thread Ronald Fischer
Hassan Schroeder wrote in post #1149926: > ?? Not, the OP originally posted: > > @card.idioms(:order => 'kind DESC') > > which is 1) not equivalent, and 2) won't work. Oops I think that's it! Will check it on the next occasion. (The OP is herewith

[Rails] Re: finding associations in sorted order

2014-06-17 Thread Ronald Fischer
Colin Law wrote in post #1149914: > On 17 June 2014 13:34, Ronald Fischer wrote: >> In my schema, Idiom has an integer column kind. Given a certain card, I >> (1) @card.idioms(:order => 'kind DESC') >> >> This doesn't seem to have any effect. >

[Rails] Re: finding associations in sorted order

2014-06-17 Thread Ronald Fischer
Walter Davis wrote in post #1149912: > On Jun 17, 2014, at 8:34 AM, Ronald Fischer wrote: > It sounds to me as though maybe all of your idioms have the same value > (or null) in their kind column. No, they have correct values (1, 2 and 3). Actually, the logic of the application ens

[Rails] finding associations in sorted order

2014-06-17 Thread Ronald Fischer
I have in my model class Card < ActiveRecord::Base has_many :idioms,dependent: :destroy end class Idiom < ActiveRecord::Base belongs_to :card end In my schema, Idiom has an integer column kind. Given a certain card, I would like to have all associated idioms, but sorted in descending or

[Rails] Re: DB query: Finding only the id values

2014-06-15 Thread Ronald Fischer
Hassan Schroeder wrote in post #1149759: > On Sun, Jun 15, 2014 at 1:29 AM, Ronald Fischer > wrote: > (assume that ) box = Box.find(box_id) > > box.cards # has the cards you want *if* you need all the attributes > > box.cards.pluck(:id) # builds a query to fetch *only* th

[Rails] Re: DB query: Finding only the id values

2014-06-15 Thread Ronald Fischer
Colin Law wrote in post #1149753: > On 15 June 2014 09:29, Ronald Fischer wrote: > Assuming that you have the relationships setup accordingly (so card > belongs_to box and box has_many cards or something similar) Actually I have both (belongs_to in :cards and has_many :cards in box);

[Rails] DB query: Finding only the id values

2014-06-15 Thread Ronald Fischer
e SQL query would be so simple that I don't fear I would run into compatibility problems when exchanging one database for another, I wonder whether there is a simpler solution, using just ActiveRecord functions. Ronald -- Posted via http://www.ruby-forum.com/. -- You received this messag

[Rails] Re: CSS Load Order Headache

2014-06-15 Thread Ronald Fischer
Thanks a lot for the helpful answers! Both solutions make sense to me. -- 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 unsubscribe from this group and stop receiving emails from it, send an e

[Rails] CSS Load Order Headache

2014-06-14 Thread Ronald Fischer
I used rails generate scaffold for part of my application, and this looks fine so far. Now I would like to change a style for the element, which happens to be defined in scaffold.css.scss. I don't want to touch the generated file, so I place the definition into my own file. I have one (rkanren.cs

[Rails] SerializationTypeMismatch when retrieving (not: storing) object

2014-06-12 Thread Ronald Fischer
I don't understand the following example from the ActiveRecord::Base section in http://api.rubyonrails.org/ : == class User < ActiveRecord::Base serialize :preferences, Hash end user = User.create(preferences: %w( one two three )) User.find(user.id).preferences# raises SerializationType

[Rails] Calculating string length in a model

2014-06-11 Thread Ronald Fischer
I'm using Ruby 2.1.1 and Rails 4.1.1, with SQLite and, respectively, Postgres. All my strings are supposed to be UTF-8 encoded. Now, assuming I create a field in my model as data:string{20} can I safely assume, that this will store up to 20 characters, even if each character happens to be 3

[Rails] Re: Form helper: Linking radio button to label

2014-06-09 Thread Ronald Fischer
tribute, or Got it! I now can see my mistake. The label should be <%= d.label :filtertype_lefteq, 'Starts with...', value: 'lefteq' %> > 2. The label wraps around the button and does not have a "for" > attribute. Just out of curiosity: How can *that* b

[Rails] Re: Design question: Redirection to a "create" action.

2014-06-09 Thread Ronald Fischer
Thank you so much to go through all the trouble and even lay out an example for the code. While I have meanwhile already redesigned the login logic, reading the short tutorial of Reform on github, and also your example, let's me think that I could use Reform well for another piece of my applica

[Rails] Form helper: Linking radio button to label

2014-06-05 Thread Ronald Fischer
My form essentially looks like this: <%= form_for :xxx, url: xxxs_path, method: 'get', enforce_utf8:true do |d| %> <%= d.text_field('filter', value: @filter, maxlength:64, size:16) %> <%= d.radio_button(:filtertype, 'regexp') %> <%= d.label :filtertype_regexp, 'Regular Expression', value: 'r

[Rails] Re: Re: Re: Design question: Redirection to a "create" action.

2014-06-05 Thread Ronald Fischer
mike2r wrote in post #1148859: > I do think that ajax is a good recommendation. Selecting, creating, or > changing a dictionary could be accessed from any page making it much > more > user friendly and a success growl is fine, but again, you should be > prepared to handle the case where a user tri

[Rails] Re: Re: Re: Design question: Redirection to a "create" action.

2014-06-05 Thread Ronald Fischer
Jesse Knutsen wrote in post #1148836: > On 6/4/14, 1:19 PM, Ronald Fischer wrote: >> However, the form has two buttons, and one is (from the viewpoint of >> logic) doing a GET and the other one should do a POST. Of course I can't >> have both. Maybe it is the form which

[Rails] Re: Re: Design question: Redirection to a "create" action.

2014-06-04 Thread Ronald Fischer
Jesse Knutsen wrote in post #1148812: > On 6/4/14, 10:08 AM, Ronald Fischer wrote: > Essentially you are calling two different actions right now (in your > design) where the first leads to the second through a redirect. This > redirect will actually redirect the user on the browser le

[Rails] Re: Re: Design question: Redirection to a "create" action.

2014-06-04 Thread Ronald Fischer
Jesse Knutsen wrote in post #1148818: > On 6/4/14, 10:30 AM, Colin Law wrote: >> > You are 100% correct, but he was going to redirect to Dicts#new. Only as a work-around, but as I said, I was not so happy with this either. > DictController > ... > new > if params[:new_dict] >

[Rails] Re: Design question: Redirection to a "create" action.

2014-06-04 Thread Ronald Fischer
Walter Davis wrote in post #1148806: > I would definitely not mix the login logic with the "show the home page" > logic as you seem to have done here I fully agree that from a programmer's viewpoint it would make the problem much cleaner to solve. However, when developing software, I try to see th

[Rails] Re: Design question: Redirection to a "create" action.

2014-06-04 Thread Ronald Fischer
Jesse Knutsen wrote in post #1148805: > I am not a huge fan of an approach that would need to redirect in this > way. > > Instead, why not create a new class called login or something like that. > > You will need to adapt a bit to your needs, but the basics are sound and > should apply nicely. I d

[Rails] Design question: Redirection to a "create" action.

2014-06-04 Thread Ronald Fischer
My application should behave like this: - My application manages (among others) a resource called "Dicts", i.e. there is a dicts_controller, and my routes.rb contains a "resources :dicts". - I have a home page (starting page), which will eventually contain some user authentification (not implemen

[Rails] Help me understanding assets path

2014-05-31 Thread Ronald Fischer
I've put my favicon into app/assets/images and include in my header <%= favicon_link_tag 'my_favicon.jpg' %> The favicon is correctly recognized by the browser, so it works perfectly. When viewing the source code, I see to my surprise that the following HTML code is generated: Aside from

[Rails] Re: Beginner's routing question: Redirecting to a different controller

2014-05-28 Thread Ronald Fischer
ntication part of the tutorial. Thanks, I will do so. I already started to read the tutorial you recommended, and I must say it's really well written! Ronald -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on

[Rails] Re: Beginner's routing question: Redirecting to a different controller

2014-05-27 Thread Ronald Fischer
Thank you for the suggestions. I went through the tutorial found on the web (which was explaining the concepts using the example of making a blog site), but could relate what I have learned, only to the concept of the idioms in my project, but not to the rest of my application. I now see that i

[Rails] Re: Finding a record which I had created

2014-05-27 Thread Ronald Fischer
Walter Davis wrote in post #1147134: > @dict = Dict.where(:dictname => dict_name).first > > It will either return a record, or nil. Thanks a lot. This works perfectly well! Ronald -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed t

[Rails] Re: Beginner's routing question: Redirecting to a different controller

2014-05-26 Thread Ronald Fischer
You did grasp the concept of my application amazingly well, only that the only possible ways to "edit" a dict is to add and remove idioms (would you see this as editing the dictionary, or as manipulating the Idiom class?). The reason why I did not follow the CRUD way - and maybe this I was mis

[Rails] Re: Finding a record which I had created

2014-05-26 Thread Ronald Fischer
g from the API docs the information I need. Just for my understanding: Could you also please explain, why my original (complicated) version failed? Ronald -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rai

[Rails] Re: Finding a record which I had created

2014-05-26 Thread Ronald Fischer
nt to display an error message to the user. Hence, find_or_create isn't suitable for me. BTW, I also tried Dict.find(:dictname => dict_name) but this too complained that there is a hash, which can't be converted to an integer. Ronald -- Posted via http://www.ruby-forum.c

[Rails] Finding a record which I had created

2014-05-26 Thread Ronald Fischer
I thought this is an easy one, but: I have created a record, and later would like to retrieve it again. Here is an excerpt of my schema: create_table "dicts", force: true do |t| t.string "dictname" ... end My model ensures that dictname is unique: validates :dictname,

[Rails] Re: Beginner's routing question: Redirecting to a different controller

2014-05-25 Thread Ronald Fischer
Thanks a lot for the detailed explanations. Two remarks for this: As for the naming, my application evolves a dictionary of foreign language idioms, and the main purpose it to train the user in the usage of these idioms. From the perspective of the user, there are 3 types of "screens" (HTML pag

[Rails] Re: Re: link_to with array parameter for URL : What does it mean?

2014-05-25 Thread Ronald Fischer
he email address mentioned at the bottom of the apidock.com page. I'm still pretty new in the development with Rails, as you certainly have noticed, and at this stage, "fixing" something - even if it is only in the docs - could do more harm than good. Ronald -- Posted via htt

[Rails] Re: Beginner's routing question: Redirecting to a different controller

2014-05-24 Thread Ronald Fischer
mike2r wrote in post #1146887: > I would use resources, as > Scott > suggests, but limit the actions that you really need such as: > > resources :dicts, only: [:show] Now in my case, the action has a "non-standard" name, i.e. ":manage". Can I use this too in the "only:" array, or should I instead

[Rails] Re: Beginner's routing question: Redirecting to a different controller

2014-05-24 Thread Ronald Fischer
Евгений Шурмин wrote in post #1146886: > get 'dict/:id/manage', to: 'dict#manage' , as: :dict Could you please kindly explain, what the effect of the "as: :dict" is in this case? I understood that I need the "as:" parameter for those cases where I want to name the route differently, but in this

[Rails] Re: link_to with array parameter for URL : What does it mean?

2014-05-24 Thread Ronald Fischer
Thanks for the explanation! I noticed your response only now, and it would have at least partially answered my other question I had posted in this forum too ;-) I think I get the idea with nested routing now. What I still don't understand is a *syntactic* issue: How to map this feature to the

[Rails] Beginner's routing question: Redirecting to a different controller

2014-05-23 Thread Ronald Fischer
I have a problem passing control from one controller to the next. Here are the details: I have a model 'Dict' with primary key :dictname. I have two controllers, named 'Login' and 'Dict'. The application starts in views/login/index.html.erb, where I have - among other stuff - an entry field for th

[Rails] link_to with array parameter for URL : What does it mean?

2014-05-23 Thread Ronald Fischer
(Crossposting Note: This topic has been posted already at https://railsforum.com/topic/1933-link-to-with-array-parameter-for-url-what-does-it-mean , but did not get a reply so far) I found in http://guides.rubyon...-a-partial-form the following example: link_to 'Destroy Comment', [comment.article

[Rails] Re: Please help modelling "has-a-vector-of-3" relationship

2014-05-21 Thread Ronald Fischer
tamouse m. wrote in post #1146720: > As much as I hate to say is, this *might* be a case for single table > inheritance... So be it! ;-) Thank you for the confirmation. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Rub

[Rails] Please help modelling "has-a-vector-of-3" relationship

2014-05-21 Thread Ronald Fischer
In my application, I have 3 models. Let's call them X, Y and Z for brevity. Their relationship are as follows: - One X has an arbitrary number (maybe zero) items of type Y. - One Y has 2 or 3 items of type Z. Moreover, these items are *ordered*, i.e. I need to record somehow, which is the first o

[Rails] Re: rails generate -p complains about Spring server

2014-05-21 Thread Ronald Fischer
Fab Forestier wrote in post #1146691: > If you take a look in the helper ( rails generate model -h) the options > are after attributes of your model like this rails generate model Word > repr:string level:integer atari:integer triple:references -p Thanks so much! Now it's obvious... -- Posted v

[Rails] rails generate -p complains about Spring server

2014-05-21 Thread Ronald Fischer
Rails 4.1.1, Ruby 2.1.1, OSX 10.6 This works: rails generate model Word repr:string level:integer atari:integer triple:references This does not: rails generate model -p Word repr:string level:integer atari:integer triple:references It raises the error message: .../ruby-2.1.1/gems/spring-1.1.3

[Rails] Re: (Beginner) ActionController::UrlGenerationError - No route matches

2014-05-16 Thread Ronald Fischer
became obvious!! Thanks a lot. Ronald -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk

  1   2   >